H
HLCruz via AccessMonster.com
Please help - I am new to VBA ... I have a form in which I'm using a
"searching" list box that allows users to type in a client name (last name,
first name) in a text box. The code "searches" through the records in a list
box and hightlights the correct client name as you type. Now I'd like for
the form to populate with the correct record information once I select the
client (either by click or enter).
I have tried using the following code for the On Click property in my list
box, for which I get a Run-Time error "type mismatch".
Private Sub lstNameSearch_Click()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Key] = " & Str(Nz(Me![cboFindRecord], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
This code works fine for the combo box I have that allows people to search by
scrolling through the names alphabetically. What am I not understanding here?
Thanks to anyone who could help!
"searching" list box that allows users to type in a client name (last name,
first name) in a text box. The code "searches" through the records in a list
box and hightlights the correct client name as you type. Now I'd like for
the form to populate with the correct record information once I select the
client (either by click or enter).
I have tried using the following code for the On Click property in my list
box, for which I get a Run-Time error "type mismatch".
Private Sub lstNameSearch_Click()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Key] = " & Str(Nz(Me![cboFindRecord], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
This code works fine for the combo box I have that allows people to search by
scrolling through the names alphabetically. What am I not understanding here?
Thanks to anyone who could help!