Murray Brown
asked on
Access VBA SQL - Add records to two linked tables
Hi
In my Access VBA SQL code I need to add records to two linked tables: "Orders" and "Order Details".
I need to first add a record to the "Orders" table. Then I need to use the new number in the "ID" column
of this table and use it to insert records in the "Order Details" table, which has a field called "Order ID".
How do I do this?
Thanks
In my Access VBA SQL code I need to add records to two linked tables: "Orders" and "Order Details".
I need to first add a record to the "Orders" table. Then I need to use the new number in the "ID" column
of this table and use it to insert records in the "Order Details" table, which has a field called "Order ID".
How do I do this?
Thanks
ASKER
Hi. Thanks. I should have clarified that I am looking for the VBA code to do this
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much
For example:
- You insert Orders with these columns: OrderDate, OrderTime, ClientID
- You insert OrderDetails with these columns: OrderDate, OrderTime, ClientID, ProductID, Quantity
The you insert data into Orders (and OrderIDs will be generated) and then join data back for OrderDetails to Orders by OrderDate, OrderTime, ClientID (this is the key) and you will get back the OrderID from Orders.