Hi guys i have search form on my database which searches for results from a query called qry_searchBK and this query is derived from a table called tbl_bookings. I have a search button on the form which has on OnClick event as seen below. When i click on the search button i get an "Run-time error 2001 you cancelled the previous opertaion" message, it then asks you to Debug or End. If i choose to Debug, it always highlights "Me.FilterOn = True" (second line of coding below), any suggestions?
YOU CAN SEE THE SEARCH FORM & TRY FOR YOURSELF AT:-
------------------------------------------------------
Private Sub Command54_Click()
Me.FilterOn = True
Me.Filter = search1 & " Or " & search2 & " Or " & search3 & " Or " & search4
DoCmd.RunCommand acCmdDatasheetView
DoCmd.MoveSize , , 18100, 6700
End Sub
Function search1()
If IsNull(Lookup1) Or Lookup1 = "" Then
search1 = "[Tag_Number] = 'xxxx'"
Else
search1 = "[Tag_Number] Like '" & Lookup1 & "*'"
End If
End Function
Function search2()
If IsNull(lookup2) Or lookup2 = "" Then
search2 = "[Customer Name] = 'xxxx'"
Else
search2 = "[Customer Name] Like '" & lookup2 & "*'"
End If
End Function
Function search3()
If IsNull(lookup3) Or lookup3 = "" Then
search3 = "[Signed In] = 'xxxx'"
Else
search3 = "[Signed In] Like '" & lookup3 & "*'"
End If
End Function
Function search4()
If IsNull(Lookup4) Or Lookup4 = "" Then
search4 = "[Signed Out] = 'xxxx'"
Else
search4 = "[Signed Out] Like '" & Lookup4 & "*'"
End If
Me.FilterOn = True
Me.Filter = search1 & " Or " & search2 & " Or " & search3 & " Or " & search4
Lookup1 = ""
lookup2 = ""
lookup3 = ""
Lookup4 = ""
End Function
YOU CAN SEE THE SEARCH FORM & TRY FOR YOURSELF AT:-
------------------------------------------------------
Private Sub Command54_Click()
Me.FilterOn = True
Me.Filter = search1 & " Or " & search2 & " Or " & search3 & " Or " & search4
DoCmd.RunCommand acCmdDatasheetView
DoCmd.MoveSize , , 18100, 6700
End Sub
Function search1()
If IsNull(Lookup1) Or Lookup1 = "" Then
search1 = "[Tag_Number] = 'xxxx'"
Else
search1 = "[Tag_Number] Like '" & Lookup1 & "*'"
End If
End Function
Function search2()
If IsNull(lookup2) Or lookup2 = "" Then
search2 = "[Customer Name] = 'xxxx'"
Else
search2 = "[Customer Name] Like '" & lookup2 & "*'"
End If
End Function
Function search3()
If IsNull(lookup3) Or lookup3 = "" Then
search3 = "[Signed In] = 'xxxx'"
Else
search3 = "[Signed In] Like '" & lookup3 & "*'"
End If
End Function
Function search4()
If IsNull(Lookup4) Or Lookup4 = "" Then
search4 = "[Signed Out] = 'xxxx'"
Else
search4 = "[Signed Out] Like '" & Lookup4 & "*'"
End If
Me.FilterOn = True
Me.Filter = search1 & " Or " & search2 & " Or " & search3 & " Or " & search4
Lookup1 = ""
lookup2 = ""
lookup3 = ""
Lookup4 = ""
End Function