PC said:
Is there an alternate method to link a subform to the main form other
than using the Master/Child properties in the subform control?
Thanks,
PC
If you don't mind a little bloat you can set the subform's RecordSource
dynamically in the main form's OnCurrent event. The bloat should be
minor in your case if the subform's RecordSource will only be pulling in
one record (or a few) at a time. This method works even in some unusual
cases where the Link Child/Master Fields property does not. It might
look something like:
Private Sub Form_Current()
SubformToMain.Form.RecordSource = "SELECT * FROM tblPeople WHERE
PersonID = " & txtPersonID.Value & ";"
End Sub
Here SubformToMain is the name of the subform control on the main form
and frmSubformMain is the SourceObject for the Subform control. Then if
frmSubformMain has a subform you can use the OnCurrent event of
frmSubformMain to set the RecordSource of its subform. Changing the
RecordSource of the subform in frmMain should also cause the subform's
OnCurrent event to fire and thereby bring the sub-subform to the first
record of an appropriate set. Once the correct datasets are in all the
subforms, you can still use RecordsetClone with the Bookmark property to
navigate to a particular record.
James A. Fortune
(e-mail address removed)
Christmas is about forgiveness.