wildcard search not working!!!!

badangel

Registered User.
Local time
Today, 01:00
Joined
Jan 31, 2003
Messages
26
Hi everyone,

Hope some one can help me with this! I am trying to do a wildcard search when the user enters a name into a text box and then presses a search button. I based the code I have on an example from Mile-O-Phile found in a previous thread but when I run it it comes up with a runtime 424 error - Object Required. Therefore, I think i must be being daft and have missed out a vital bit - anyone know what the problem is? The code I am using is:

Private Sub FindName_Click()

If IsNull(Me.NameBox) Then
MsgBox "You have not entered any filter criteria.", vbExclamation, "Search For Name"
Exit Sub
End If
With ListBox
.RowSource = "SELECT Customer.CustType, Customer.CompanyName FROM Customer WHERE [CompanyName] Like '" & _
IIf(chkExactMatch = True, Me.NameBox & "';", "*" & Me.NameBox & "*';")
.Requery
End With

End Sub


Thanks a million in advance.
 
What line does the error highlight?

Is ListBox actually the name of your listbox?
 
Hi Mile-o

Thanks for replying. I actually worked it out already - your reply is right, I had ListBox instead of the correct name which is ListResults for my listbox. Just shows how a careless error can cause so much grief!

Thanks as well for the example code that I used off another thread. It has been extremely helpful. I will drink a toast to your Access expertise in the pub tonight!!

Regards
Badangel
 
Oh well, no reply, I was going to turn up and demand a beer...:rolleyes:
 
Here's your reply! Pub undecided as yet but bound to be one of the many hostelries on Sauchiehall St. in Glasgow. If you're in the area, I think i owe you a beer or 10 for all the help!:)
 
I'll be the one selling The Big Issue as you walk in - I usually stand outside one of any pubs. "Spare me some change."
 

Users who are viewing this thread

Back
Top Bottom