I have pasted a code below which used by John Big Booty in a tutorial to open another form and populate its fields from a list box in another form.
After creating a simple form with fields, I have pasted this code in the double click event for the list box, but on double click, access gives me "missing operator in query expression '[RecordID]=name of the selected client in the list box'. The list box holds the RecordID (primary key), and two other fields.
I can't get the double click to function, what should be done?
Here's the code: (listbox name is SearchResults)
Private Sub SearchResults_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "newform"
stLinkCriteria = "[RecordID]=" & Me![SearchResults]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
After creating a simple form with fields, I have pasted this code in the double click event for the list box, but on double click, access gives me "missing operator in query expression '[RecordID]=name of the selected client in the list box'. The list box holds the RecordID (primary key), and two other fields.
I can't get the double click to function, what should be done?
Here's the code: (listbox name is SearchResults)
Private Sub SearchResults_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "newform"
stLinkCriteria = "[RecordID]=" & Me![SearchResults]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub