G
Guest
Here is a snippet of my code (which anyone familiar with the form will be
able to recognize). Where I'm having problems is starting at the [chkQS]
portion of the code. With this line missing, it works fine:
If Not IsNull(Me.cboPIN) Then
strWHERE = strWHERE & "([PIN] = """ & Me.cboPIN & """) AND "
End If
If Me.[chkQS] = "Yes" Then
strWHERE = strWHERE & "([RDisposition] = ""New Tool Required"" OR
[RDisposition] = ""Opp-New Tool"" OR [RDisposition] = ""Rework"" OR
[RDisposition] = ""Opp-Rework"") AND "
End If
lngLen = Len(strWHERE) - 5
If lngLen <= 0 Then
MsgBox "No criteria selected", vbInformation, "No Search Criteria"
Else
strWHERE = Left$(strWHERE, lngLen)
Debug.Print strWHERE
Me.Filter = strWHERE
Me.FilterOn = True
End If
End Sub
I also tried a permutation:
If Not IsNull(Me.chkQS) Then
strWHERE = strWHERE & "([RDisposition] = ""New Tool Required"" OR
[RDisposition] = ""Opp-New Tool"" OR [RDisposition] = ""Rework"" OR
[RDisposition] = ""Opp-Rework"") AND "
This worked, except the code always ran that portion of the query. Being a
non-programmer, I'm not sure why the code isn't working the way I want it to.
Could someone please help me with my code syntax for this checkbox? Thank
you!
able to recognize). Where I'm having problems is starting at the [chkQS]
portion of the code. With this line missing, it works fine:
If Not IsNull(Me.cboPIN) Then
strWHERE = strWHERE & "([PIN] = """ & Me.cboPIN & """) AND "
End If
If Me.[chkQS] = "Yes" Then
strWHERE = strWHERE & "([RDisposition] = ""New Tool Required"" OR
[RDisposition] = ""Opp-New Tool"" OR [RDisposition] = ""Rework"" OR
[RDisposition] = ""Opp-Rework"") AND "
End If
lngLen = Len(strWHERE) - 5
If lngLen <= 0 Then
MsgBox "No criteria selected", vbInformation, "No Search Criteria"
Else
strWHERE = Left$(strWHERE, lngLen)
Debug.Print strWHERE
Me.Filter = strWHERE
Me.FilterOn = True
End If
End Sub
I also tried a permutation:
If Not IsNull(Me.chkQS) Then
strWHERE = strWHERE & "([RDisposition] = ""New Tool Required"" OR
[RDisposition] = ""Opp-New Tool"" OR [RDisposition] = ""Rework"" OR
[RDisposition] = ""Opp-Rework"") AND "
This worked, except the code always ran that portion of the query. Being a
non-programmer, I'm not sure why the code isn't working the way I want it to.
Could someone please help me with my code syntax for this checkbox? Thank
you!