Using MS Access/Primary Key question


Hi there, I have a question about primary keys.  I have an autonumber field in the parent table and and a number field (long integer) in the child table.  The relationship between the parent and child table is one-to-many.  I have one purchase where one or more invoices will be related to the record in the parent table.  How do I get the number field in the child table to automatically update to relate to the primary key in the parent table.  By default, the field is blank.  The records that are entered into the invoices table are new records and entered on a daily basis.  I am using sequential numbering for users to add the records in the parent table.  So when a new purchase is created, it looks like the record is identified by the new number that was automatically created, but it isn't, it is really identified by an autonumber. My apologies if this sounds confusing.  Thanks so much for the help on sequential numbering, it works great.  Thanks again for all of your help.  It is greatly appreciated as always.  Carla  :)

Hey Carla,

Normally, new records for a child table are entered using a subform linked to the main form on the Key field. When this is done, the FK is automatically entered.

If you don't use a subform, then you would use a combobox bound to the FK field that the user selects the Parent record from. If they are selecting from the Sequential number, you still tie it to the Autonumber.  

Using MS Access

All Answers

Answers by Expert:

Ask Experts




I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.


I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Brooklyn College BA

©2017 All rights reserved.