Simple Master Detail question

T

Tito Luyo Murata

Hi all:

I think this is a stupid question, but here it goes (sorry for my english)

I have a classic Orders / OrderDetails tables in Access ( I suppose is same
in SQL server ),
Orders table have an autonumeric field, called OrderID , which is primary
key,
when I create a record in Orders table, through an SQL-INSERT command,
Access automatically give this record the OrderID,
the question is :
how can I get this number, OrderID to use, to put in OrderDetails related
rows.

I hope can understand me :p

Thanks in advance
Greetings
Tito
 
W

William \(Bill\) Vaughn

See my article on handling identity issues. www.betav.com\articles.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
J

Jos

Tito said:
Hi all:

I think this is a stupid question, but here it goes (sorry for my
english)

I have a classic Orders / OrderDetails tables in Access ( I suppose
is same in SQL server ),
Orders table have an autonumeric field, called OrderID , which is
primary key,
when I create a record in Orders table, through an SQL-INSERT command,
Access automatically give this record the OrderID,
the question is :
how can I get this number, OrderID to use, to put in OrderDetails
related rows.

I hope can understand me :p

Thanks in advance
Greetings
Tito

It's not a stupid question, it is a very common one. Look here:
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconRetrievingIdentityOrAutonumberValues.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top