Passing values from main form to a new record on a child form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a main form and a linked child form.

When I start a new record in the child form I want to bring 2 code fields
from the main form to the new record. The child form in continuous and users
are typically adding new records in the child form.

I think I could add a "Add New Record" command button to run a macro but
users will forget and just go to the the bottom of the list and start a new
record and then I'll be missing the codes.

Isn't there something like a "onNewRecord" event that would allow me to run
a macro to set the values, as soon as a new record is started? I don't find
one.

Thanks
 
The form's BeforeInsert event fires when you begin to add a new record.

But something is wrong here, Larry. If you have set up the form correctly
with these 2 fields in the LinkMasterFields/LinkChildFields properties,
Access will fill them for you automatically.
 
Hmmm maybe it's because I created them with the wizard? I just repeated it
and it didn't allow me to select master/child fields. And I don't seem to be
able to find the links in the form properties. I'll test creating the forms
in design view when I get off work.

Or is that the right direction? The Filter property on the child form
contains the one key field that links the 2 forms but that field doesn't
populate on the child form when I add a new record.

Any direction would be greatly appreciated.

Thanks
 
Open the main form in design view.
Right-click the edge of the subform control, and choose Properites.
The properites are on the Data tab.

The crucial thing is to get the properties of the subform control, not those
of the form in the subform control.
 
PERFECT!! Those little details are so critical to us newbies. I knew I had
seen it in the past but couldn't for the life of me find it again.

I appreciate your help.

Maybe you want to take a shot at my other post in the reports section,
titled "Running Sum Across Groups" dated 2/28 at 2am pst.

Thanks again.

Larry
 
Back
Top