Refering to subforms on tabbed controls

A

a.t.brooks

Hi
I have a main from on one tabbed page and a "daughter" form on the
other. If I select a record on the main form, can I then switch to the
second tab page and add records so that they are linked to the record
on the first tab?
Thanks
 
G

Graham Mandeno

I'm not sure I understand you. You can't have a "main form on a tabbed
page". Any form embedded in another form, whether it is on a tab control
page or not, is a SUBFORM.

Do you mean that you have a tab control on your MAIN form, where one page
contains data fields from your main form's Recordset and another page
contains a linked subform?

If so, then all you need to do is set focus to the subform (either using the
mouse or with code) after adding the record to your main form, and go from
there.

If, on the other hand, you have TWO subforms, one listing the records on the
"one" side of a one-to-many relationship, and the other listing the related
"many" records, then you can add a hidden textbox named txtLink to your main
form (not the first subform) with the following ControlSource:
=[Subform1].Form![name of primary key field]

Then, for your second subform, set LinkMasterFields to txtLink, and set
LinkChildFields to the name of the foreign key field in your many-side
table.
 

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