linking forms on tab controls

  • Thread starter Thread starter D. Minter
  • Start date Start date
D

D. Minter

I want to use a tab control to separate linked forms
(master, sub1). I created the forms independently, then
placed each on a 2 page tab control, entering the linking
fields manually in the sub form's properties sheet. The
problem: Access seems to have accepted the link, and the
sub shows the correct data for the first master record,
but when another record in the master is selected (on page
1), none of the linked detail records records appear.
The syntax used was: child: fieldname. For the Master:
[formname].form![fieldname].

Any suggestions? Should [page1] have been in the master
link description? What is the proper syntax? Is there a
better way to do this?

DM
 
When using tab controls, all of the subforms in the control are loaded and
active unless you code them otherwise. the master form is the form that the
tab control is on. to set this up to keep every subform in sync you need a
control on the master form that is the same as a unique record of each
subform. now link each forms master and child field to the appropriate field
pairs. then use the on current event of each subform to update the master
field.
Like this: master field does not need to be bound to a recordsource but does
need to have the field used as the master link default to a real value that
matches a record in the link child field of each subform. the master field
does not need to be visible either.
example:
form "MasterInventory" has a control named InventoryNumber. On each page of
the tab control the recordset has a field InventoryNumber in it. in design
view click on the border of each subform control and access the properties.
under the data tab are the link child field and link master field
properties. set them to InventoryNumber ( the Name of the control that has
matching data.) Do this for every subform in the tab control. for each
subform place code in the on current event that sets the value of the parent
forms control.
subform_current()
Me.Parent!InventoryNumber = Me.InventoryNumber
end sub
HTH
 
Back
Top