I am trying to write codes that when a user clicks a record in a datasheet in
a subform, and the matching record will pop up.
I will appreciate anyone who can give me a hand.
Best regards
SC
Damiaan - 19 Mar 2005 18:53 GMT
Your datasheet is based on a form.
In the form you can trigger the oncurrent event.
In the on-current event place your code. Something like:
docmd.openform "myform",,,"id-field=" & me.idfield
Marshall Barton - 19 Mar 2005 19:10 GMT
>I am trying to write codes that when a user clicks a record in a datasheet in
>a subform, and the matching record will pop up.
You'll need to use some VBA code in the subform's Current
event.
If you want to open another form to the same record in the
datasheet subform:
On Error Resume Next
DoCmd.Close acForm, "otherform"
On Error GoTo ????
DoCmd.OpenForm "otherform", , ,"keyfield=" & Me!keyfield
If you want the main form to navigate to the same record:
With Me.Parent.RecordsetClone
.FindFirst "keyfield=" & Me!keyfield
If Not .Nomatch Then
Me.Parent.Bookmark = .Bookmark
End If
End With

Signature
Marsh
MVP [MS Access]
Dennis - 21 Mar 2005 15:33 GMT
If the datasheet and the form are the same then all you need to do is place
the following in the Form_Click event
RunCommand acCmdSubformFormView
> I am trying to write codes that when a user clicks a record in a datasheet in
> a subform, and the matching record will pop up.
[quoted text clipped - 4 lines]
>
> SC