I have a report which is linked to a query. The report lists Names of Visitors,and dates of visits. I also have a form which I use to add/store the names of the visitors and their visit date. Visitors frequently re-visit the site, so therefore for each visit they do, I add as a new record, each with their own Primary ID number on the form.
What I'm trying to achieve via a VBA code within the report is this, I wish to be able to click on the name of the visitor i.e. John Smith, which will then open/filter all of John Smiths forms. At the moment my report lists all of "John Smiths" visits by ID numbers, so I'm having to individually click on each ID to open up his record, my VBA code for that is:
Private Sub ID_Click()
On Error GoTo myError
Dim varWhereClause As String
varWhereClause = "ID = " & Me!ID
DoCmd.OpenForm "frmVisitorScreen", , , varWhereClause
leave:
Exit Sub
myError:
MsgBox Error$
Resume Next
End Sub
I'm wondering if I can use something similar. Help with this would be most appreciated.
Thank you.