In my ongoing efforts to actually learn this stuff, I’m trying to work through “How to Filter a Report from a Pop-Up Form as presented in Microsoft Knowledge Base Article – 208529.
I keep getting a compile error from the set-filter command button.
Here is what I have typed
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) & ” This is the line that I’m getting a message on . Compile error: Expected line number or label or statement or end of statement. There is also an And ” on the next line that it doesn’t like either. I’ve tried everything I can think of. If I have typed it differently than the instructions, I can’t see it. Please point out what simple thing I’m overlooking.
And ”
End If
Next
If strSQL ” ” Then
‘ Strip Last ” And ”
strSQL = Left(strSQL, (Len(strSQL) – 5))
‘ Set the Filter Property
Reports![rptCustomers].Filter = strSQL I got a message when I tried to set the filter that I was using a property improperly.
Reports![rptCustomers].FilterOn = True
End If