Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add information in 2 tables 1

Status
Not open for further replies.

Kindi

Programmer
Jan 31, 2001
54
GB
I have a form where a user enters information, and the primary key is the autonumber created by access. Some information must go into another table, I understand how to place information into the second table, but how can the second table have the same primary key number that is created for the first table. Would a trigger need to be coded or does access has a simpler approach?

Please Help!

Thanks
Kindi
 
Hi Kindi,
You probably don't want or need to see the "foreign" key from the other table 'cause it's supposed to be the same as the "primary" . Place it on your form visible or not and set it's "default value" equal to your other fields value...something like this:

=Forms![NameOfYourForm]![NameOfYourPrimaryKeyField]

Now by default, any entry made in to the second tables fields on that form should "take" the primary key's value.
Write back if you have any trouble... Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top