Is there some reason that you aren't using the LinkMasterFields and
LinkChildFields of the Subform Control? Main Form with Subform on identical
keys is a little unusual... can you clarify?
Or, do you have a continuous forms view Form in the Subform Control and want
to "scroll" the Records? If so, in a main Form with a Subform Control named
sbfMainRel, with the matching value in Control txtMainID on the main Form,
and the corresponding unique ID in the Field of the RecordSource of the
Form embedded in the Subform Control named MainRelID, the following worked
for me to "scroll" the continuous forms view in the Form embedded in the
Subform Control. {Note: for this code, it doesn't matter what the name of
the main Form is, nor the name of the Form embedded in the Subform Control.}
Replace the name of the subform control, the name of the Text Box where the
matching value is displayed on the main Form, and the name of the Field...
then put the code in the Current event of the main Form.
Private Sub Form_Current()
Me.sbfMainRel.Form.RecordsetClone.FindFirst "[MainRelID] = " &
Me.txtMainID
If Not Me.sbfMainRel.Form.RecordsetClone.NoMatch Then
Me.sbfMainRel.Form.Bookmark =
Me.sbfMainRel.Form.RecordsetClone.Bookmark
End If
End Sub
Larry Linson
Microsoft Access MVP
"Simon" <Sv********@Versatel.nlwrote in message
news:45**********************@news.tele2.nl...
Dear reader,
How can I move the record pointer in a sub form.
The sub form is a datasheet type. Both forms have the same reference key.
How can I move the record pointer in the sub form to the key field as
specified in the main form.
Tanks for any help.
Kind regards,
Simon