Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search form

Status
Not open for further replies.

macraniano

Technical User
Jun 2, 2008
2
US
I have a text box and a list box.
List box is showing all my clients from a query that contains Lname, Fname & SSN.
I have a text box that will allow me to type the last name, or partial last name, filtering the list from the listbox (working somehow like the combobox, where you start typing and it jumps right to the letter or word you typed).

So far, on the query [qryListBox], for the Lname criteria I wrote:

Like [forms]![frmSearchTable]![txtLname].[text] & "*"

For the text box, under "On Change" Event:

Private Sub txtLname_Change()
Me!lstSearch.Requery

End Sub

and for the listbox, under "After Update"

Private Sub lstSearch_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
On Error Resume Next
rs.FindFirst "[Lname] = '" & Me![lstSearch] & "'"
If Not rs.EOF Then
Me.Bookmark = rs.Bookmark
End If

End Sub


It does work, but Every time I click on any of the people in the list, I keep getting Error 91, "Object variable, or with block variable not set" Unable to figure this out.

I would like to click on one of the options from the list, so it opens another form showing the selected person's information.

HELP!!!!



What am I missing?


Thanks!!!!
 
What is the SQL code of qryListBox ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
1) Change
Dim rs As Object
to
Dim rs as dao.recordset

2)First comment this out and show where the code breaks:
On Error Resume Next
Then once you figure that out put some real error checking in. This above method only hides any problem

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top