Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Posts
    37

    Unanswered: a simple order form

    I have been thinking this over for so long I think I am making a simple problem more complex than it needs to be. A push in the right direction would be appreciated

    Desired situtation
    I have a database setup and one part of this is to add orders that a customer requires. When a order is entered the user clicks a button which will display a combox of customers.
    The user then will select a customer and a field will appear so they can add items to the order by clicking a button to add each item until the order is complete. Once the order is filled in they then will click a button to close the form.

    Current situtation
    I currently have a combobox with all the customers in it once a customer is selected it will insert the custpomerid into the form. I then want the orderid to increase by 1, but I only want to do this once as I require many occurences of orderid for each order.


    I assume I need to read the last value of orderid in the table and then add 1 to it. Would it be best to put this in the customer combo box's on change event ? If so how do you get the value ?

    Thanks

    JD

  2. #2
    Join Date
    Mar 2004
    Posts
    118
    from my understanding of your setup, the order id is filled in before you select a customer.


    If that is true, why not just use autonumber for the orderid field in the order table?

  3. #3
    Join Date
    Dec 2003
    Posts
    37
    No orderId will only incremented when the combo box invokes the form.

    And it can't be autonumber as there are many occurences of it.

    ID - Autonumber
    OrderId Number
    ItemId Number
    Quanity Number
    CussId Number

    JD

  4. #4
    Join Date
    Mar 2004
    Posts
    118
    then just increment by 1 on customer combo box change...

    Take the order id number fom the last record (could do this with simple SQL string) set it to an integer and increment by 1.


    I assume you have 1 unique order id per customer...


    If you need multiple instances of thesame order id for different customers (dont know why) you might need to add a button to manualy increment the order id when needed.

    If I had the run of your database I'd put all the order IDs in a separate table and link it to other tables. That way you dont have repeating data and you get a nice clean id table to play around with (with unique ids).

  5. #5
    Join Date
    Dec 2003
    Posts
    37
    Thank you YevSnow

    I had benn lazy and built the database without looking at normallisation. Have cleaned the database up and as you said the orderId's are now off in a new table.

    Sql time


    JD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •