Pop-up form that creates record that links 1:1 to main form

Joined
Nov 5, 2015
Messages
1
Reaction score
0
I have a pop-up form that opens using a button on the main form in a MS Access database. The pop-up form creates a new record (in a separate table) that needs to link to the current record in the main form. How do I set this up properly?

The two forms (frmMain, frmWB) are based on 2 separate tables (tblMain and tblWB). The records have a 1:1 relationship (each main record can only have one WB1 record).

The main form (frmMain) has the primary key [ID]

The pop-up from (frmWB) has the primary key [WBID] (autonumber) and [MainID] (number).

Data entry personnel will enter the main info first (this will have to be required to avoid orphans), then click a button that saves the main record and opens the pop-up form to add the detailed info. When done, they click the close button which saves the pop-up record, closes the pop-up, and returns to the main form (which stayed open in behind). Navigation has been disabled in the pop-up and it is set to cycle the current record.

I have tried linking using the primary IDs for the two tables, but that doesn't seem to reliably link the correct ID numbers when adding a new record in the pop-up. I tried using subforms, but had problems if the navigation or 'new record' buttons on the main form were accidentally hit when entering data in the subform - that created records in tblWB that had the wrong ID numbers.
 

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