- Joined
- Feb 10, 2009
- Messages
- 1
- Reaction score
- 0
I'm trying to create a simple search function on an access database, i keep getting an invalid qualifier message when i run the search on the "Private Sub cmdsearchType_Click()" line. any ideas why? it is definately all spelt right etc.
Here's the full code if that helps?
Private Sub cmdsearchType_Click()
On Error GoTo cmdErr_searchType_Click
Dim strType As String
Dim strSearch As String
If IsNull(Me![txtSearch]) Or (Me![txtSearch]) = "" Then
MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!"
Me![txtSearch].SetFocus
Exit Sub
End If
DoCmd.ShowAllRecords
DoCmd.GoToControl ("strType")
DoCmd.FindRecord Me!txtSearch
txtSearch.SetFocus
strSearch = txtSearch.Text
If strDay = strSearch Then
MsgBox "Match Found For: " & strSearch, , "Congratulations!"
strType.SetFocus
txtSearch = ""
Else
MsgBox "Match Not Found For: " & strSearch & " - Please Try Again.", _
, "Invalid Search Criterion!"
txtSearch.SetFocus
End If
End Sub
Any help will be greatly appreciated!
thanks, Lauren
Here's the full code if that helps?
Private Sub cmdsearchType_Click()
On Error GoTo cmdErr_searchType_Click
Dim strType As String
Dim strSearch As String
If IsNull(Me![txtSearch]) Or (Me![txtSearch]) = "" Then
MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!"
Me![txtSearch].SetFocus
Exit Sub
End If
DoCmd.ShowAllRecords
DoCmd.GoToControl ("strType")
DoCmd.FindRecord Me!txtSearch
txtSearch.SetFocus
strSearch = txtSearch.Text
If strDay = strSearch Then
MsgBox "Match Found For: " & strSearch, , "Congratulations!"
strType.SetFocus
txtSearch = ""
Else
MsgBox "Match Not Found For: " & strSearch & " - Please Try Again.", _
, "Invalid Search Criterion!"
txtSearch.SetFocus
End If
End Sub
Any help will be greatly appreciated!
thanks, Lauren