adding a new record with VBA

hilbertm

Registered User.
Local time
Today, 00:11
Joined
Sep 7, 2001
Messages
46
I have 2 tables that are linked via the personnel_ID field. Table 1 holds personnel information and table 2 holds training information. The link works fine with data that is already in the database.
When I add a new record in table 1 (personnel information), I have to manually add a new record, in table 2 (training information) in order for the new person to show up in the forms that use queries derived from table 2.
Is there a way to automatically add a new record to table 2 with VBA when a new record is added to table 1?
 
Change the Query to Show all records from Table 1 and only records from Table 2 where personnel_ID matches.

Lookup Left Join/Right Join

This way you don't have to add a blank record.
 
Travis,
Thanks for the quick response. I changed the Query to Show all records from Table 1 and only records from Table 2 where personnel_ID matches.

I still have the same problem. When I add a new person to the database on the add a new person form, the new person is added to table 1. When I open the training form, the newly added person does not show up because there is no record with the new persons ID number. I set the personnel ID in table 2 to autonumber, so when a new record is opened, the number will match the new person added to table 1.

I thought that I could use some code in the add a new person form that adds a new record to table 2, which will use autonumber to generate the personnel_ID number in table 2.

I Looked up Left Join/Right Join, but I couldn’t figure out how to make this work.
 
Use a form/subform linked by your ID field to enter initial/subsequent information.
 

Users who are viewing this thread

Back
Top Bottom