Help: Multi User Order Entry Screen
Hi - I'm using VBE to write a project tracker application which uses a Master-Detail setup.
I have no problem using my "change/edit order" form because the order has already been assigned the "OrderID" (autonumber) which my detail lines automatically relate to.
My goal is to have a "Create Order" form, which does not load ANY of the existing rows into the Table Adapter, and only references the database when I call "OrdersTableAdapter.update(ordersdataset.tblorders )"
I currently have the following:
"OrdersTableAdapter"
"OrdersBindingSource"
"DetailsTableAdapter"
"DetailsBindingSource"
In my "Form_Load" I have "OrdersBindingSource.addnew()" which creates a new order and assigns it an "OrderID" of "-1". My Details datagrid then shows 1 empty line for users to begin entering information. As info is entered, the lines are all automatically assigned an "orderID" of "-1".
The problem is - when I do "OrdersBindingSource.endedit()" and "OrdersTableAdapter.update(ordersdataset.tblorders )" - the table adapter THEN adds the line to the physical database, and updates the "OrderID" to the next autonumber (i.e. 159, 200, 5000 whatever...) but then all of my detail lines are lost, because they are not related to the NEW orderID number.
How can I make my details "OrderID" update (either automatically, or via code) to the newly assigned orderID and then be saved to my "tblDetails" before they are lost?
Thanks...
Chris
|