H
Heidi
I'm using the code provided in Knowledge Base Article 208529 for using
a form to filter a report. My understanding is that, in this example,
you should be able to select an option from one or more of the combo
boxes in order to filter the report. However, when testing the form
and trying to select only from a single combo box I receive the error
"Extra ) in query expression '([Region]= "BC" And)'. I can't find an
extra ) in this code. Can anyone point out what I'm missing? Thank you
in advance.
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
a form to filter a report. My understanding is that, in this example,
you should be able to select an option from one or more of the combo
boxes in order to filter the report. However, when testing the form
and trying to select only from a single combo box I receive the error
"Extra ) in query expression '([Region]= "BC" And)'. I can't find an
extra ) in this code. Can anyone point out what I'm missing? Thank you
in advance.
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