S
shhsecurity
I found some code that lets me Filter a Report from a Popup Form. It uses 6
combo boxes with each box filtering my VehicleRecords table to the record I
am looking for. The code for this can be found here:
http://support.microsoft.com/kb/q208529
I modified just a few lines so that it would point to my VehicleRecords table.
When I enter information into any one of the combo boxes I get a Run Time
Error 13 - Type Mismatch, and then I am pointed to this code.
Private Sub Set_Filter_Click()
Dim strSQL As String, intCounter As Integer
' Build SQL String.
For intCounter = 1 To 6
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) - 6))
' Set the Filter property.
Reports![VehicleREG].Filter = strSQL
Reports![VehicleREG].FilterOn = True
End If
End Sub
This part of the code is highlighted in yellow. What is wrong here?
combo boxes with each box filtering my VehicleRecords table to the record I
am looking for. The code for this can be found here:
http://support.microsoft.com/kb/q208529
I modified just a few lines so that it would point to my VehicleRecords table.
When I enter information into any one of the combo boxes I get a Run Time
Error 13 - Type Mismatch, and then I am pointed to this code.
Private Sub Set_Filter_Click()
Dim strSQL As String, intCounter As Integer
' Build SQL String.
For intCounter = 1 To 6
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) - 6))
' Set the Filter property.
Reports![VehicleREG].Filter = strSQL
Reports![VehicleREG].FilterOn = True
End If
End Sub
This part of the code is highlighted in yellow. What is wrong here?
Code:
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " _
& " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & "" _
And ""