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.
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.