C
C Tate
I am trying to create a listbox to search for records. The example I am using
is from www.databasedev.co.uk/list_box_searching.html.
I am using this code but it just will not work.
Private Sub ShowRecord_Click()
'Find a selected record, then close the search dialog box
DoCmd.OpenForm "frmSite", , , _
"[tblSite.siteID]=" & "'" & Me.FirstSearch.Column(0) & "'"
'Close the dialog box
DoCmd.Close acForm, "frmSearch"
End Sub
I note that their example is searching on a textfield whereas mine is
searching on an autonumber field. I cannot possibly imagine what I am doing
wrong. It seems to highlight the me.firstsearch.column(0) bit. I have named
the listbox firstsearch. Can access automatically work out column numbers? If
not, how do I name them? Any advice would be most helpful. Thanks.
is from www.databasedev.co.uk/list_box_searching.html.
I am using this code but it just will not work.
Private Sub ShowRecord_Click()
'Find a selected record, then close the search dialog box
DoCmd.OpenForm "frmSite", , , _
"[tblSite.siteID]=" & "'" & Me.FirstSearch.Column(0) & "'"
'Close the dialog box
DoCmd.Close acForm, "frmSearch"
End Sub
I note that their example is searching on a textfield whereas mine is
searching on an autonumber field. I cannot possibly imagine what I am doing
wrong. It seems to highlight the me.firstsearch.column(0) bit. I have named
the listbox firstsearch. Can access automatically work out column numbers? If
not, how do I name them? Any advice would be most helpful. Thanks.