H
Heidi
I'm using the VB below provided in the Knowledge Base article 208529
to filter a report using a pop-up form. I'm not a strong VB user, so
I'm not sure how to modify this code to use different numbers of
filters. Can someone please point me to the right lines that need to
be changed if I want to use two, three, six, etc. filters instead of
the five given in the example?
Thank you for your assistance!
Private Sub Set_Filter_Click()
Dim strSQL As String, IntCounter As Integer
'Build SQL String
For IntCounter = 1 To 5
If Me("Filter" & IntCounter) <> "" Then
strSQL = strSQL & "[" & Me("Filter" & IntCounter).Tag & "] "
& " = " & Chr(34) & Me("Filter" & IntCounter) & Chr(34) & " And "
End If
Next
If strSQL <> "" Then
'Strip Last " And "
strSQL = Left(strSQL, (Len(strSQL) - 5))
' Set the Filter property.
Reports![rptCustomers].Filter = strSQL
Reports![rptCustomers].FilterOn = True
End If
End Sub
to filter a report using a pop-up form. I'm not a strong VB user, so
I'm not sure how to modify this code to use different numbers of
filters. Can someone please point me to the right lines that need to
be changed if I want to use two, three, six, etc. filters instead of
the five given in the example?
Thank you for your assistance!
Private Sub Set_Filter_Click()
Dim strSQL As String, IntCounter As Integer
'Build SQL String
For IntCounter = 1 To 5
If Me("Filter" & IntCounter) <> "" Then
strSQL = strSQL & "[" & Me("Filter" & IntCounter).Tag & "] "
& " = " & Chr(34) & Me("Filter" & IntCounter) & Chr(34) & " And "
End If
Next
If strSQL <> "" Then
'Strip Last " And "
strSQL = Left(strSQL, (Len(strSQL) - 5))
' Set the Filter property.
Reports![rptCustomers].Filter = strSQL
Reports![rptCustomers].FilterOn = True
End If
End Sub