G
Guest
For those of you not familiar with the code, I've added a snippet to show you
what it looks like:
Private Sub cmdFilter_Click()
Dim strWHERE As String
Dim lngLen As Long
Const conJetDate = "\#mm\/dd\/yyyy\#"
If Not IsNull(Me.cboControlCode) Then
strWHERE = strWHERE & "([GroupID] = """ & Me.cboControlCode & """) AND "
End If
If Not IsNull(Me.txtQuickNote) Then
strWHERE = strWHERE & "([QuickNote] Like ""*" & Me.txtQuickNote & "*"")
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 wanted to be able to add a sort to the data, and starting and tried to add
the following statement to the end of the strWHERE after it chops off the
final and statement as follows:
strWHERE = Left$(strWHERE, lngLen) & "; SORT BY [GroupID]"
But this causes an error rather than give me a sort. Anyone have any ideas
why this happens (or, more importantly, what I can do to fix it)? Any help
will be greeted with major thanks and rounds of applause on this end!
what it looks like:
Private Sub cmdFilter_Click()
Dim strWHERE As String
Dim lngLen As Long
Const conJetDate = "\#mm\/dd\/yyyy\#"
If Not IsNull(Me.cboControlCode) Then
strWHERE = strWHERE & "([GroupID] = """ & Me.cboControlCode & """) AND "
End If
If Not IsNull(Me.txtQuickNote) Then
strWHERE = strWHERE & "([QuickNote] Like ""*" & Me.txtQuickNote & "*"")
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 wanted to be able to add a sort to the data, and starting and tried to add
the following statement to the end of the strWHERE after it chops off the
final and statement as follows:
strWHERE = Left$(strWHERE, lngLen) & "; SORT BY [GroupID]"
But this causes an error rather than give me a sort. Anyone have any ideas
why this happens (or, more importantly, what I can do to fix it)? Any help
will be greeted with major thanks and rounds of applause on this end!