Go to a specific record displayed within a query

  • Thread starter Thread starter CW
  • Start date Start date
C

CW

When a query displays its list of records, I would like to be able to click
on a chosen one and go to the main page (form) of that particular record i.e.
to drill down into it. The unique identifier is always the Ref. How can this
be done?
Many thanks
CW
 
HI

There are quite a few methods, this is just one.
I would create a continous form based on the query.
Make sure the Record Selector is set to Yes (you'll a small box on the left
of each record)
Open the form in design view
Select a blank area outside the design (a grey area)
Right click
Select properties
Select Event Column
Select OnClick
Right click (select biuld ...)
Select code
Add this



Private Sub Form_Click()
If IsNull(Me.Ref) Then
MsgBox "Please select a record by single clicking the box to the left of a
name", vbInformation, "No record selected"
Else
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Main Form to Open Name"
stLinkCriteria = "Ref =" & Me.Ref
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End Sub


Change Main Form to Open Name to the name of the form you want to open
Make sure that you have a control on each form called Ref

Good luck
 
Well at least Wayne was being helpful, which is more than I can say about
your response.
If you know better than him, perhaps you'd like to share it with me rather
than just making a negative comment like that.
Thanks
CW
 
Back
Top