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
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.
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 ?
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).