new record in new form

A

alexasha

i have several databases linked by ID
So far I have three tables Table 1 contains ID, and then table 2 and 3 that
are linked to Table 1 by ID field
each table have forms created (Form 1, 2,3)
I created a command button in form 2 to open form 3. I works fine, but it
opens a blank form and does not transfer ID number to new record. If I would
not fill it manually, then I am not sure how the relationship will be
maintained.
How can I make sure that ID is transferred automatically to new record in
Form 3 using this command button
 
K

Ken Snell \(MVP\)

The better design approach is to have subforms within the Form 1 form, where
one subform is for the table 2 data, and the other is for the table 3 data.
ACCESS allows you to identify the linking field in the subform control's
LinkChildFields and LinkMainFields properties, and then ACCESS will
automatically insert the linking fields' values for you when you start to
enter a new record in the subform.

Otherwise, if you must maintain separate forms the way you've started,
you'll need to pass the linking field's value to the newly opened form in
the OpenArgs argument of the DoCmd.OpenForm action, and then to read and
assign that value to the appropriate field in the form using VBA code in the
form's Load event. Post back if you need more information.
 

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