MSAccess Parent/Child AutoNumber

cc96ai

Member
Joined
Mar 8, 2006
Messages
10
Programming Experience
Beginner
I have 2 tables [Orders] & [OrderDetails]

[Orders]
- orderid (autoNumber, pk)
- ...

[OrderDetails]
- orderid (FK)
- ...

How could I retieve the orderid and insert into OrderDetials ?
 
i not understand what you want~
can u explain in more detail?

if you set orderid for OrderDetails table to FK, then when you tried to insert a row into the OrderDetails table that had a orderid of 10, InnoDB would check if a orderid of 10 existed in the Orders table and return an error if such a parent row did not exist. Conversely, you would not be allowed to delete a row from the Orders table if there were rows in the OrderDetails table that referred to the row in question.
 
Back
Top