Report Filter using a Form with combo boxes

vanny

Registered User.
Local time
Yesterday, 19:01
Joined
Feb 18, 2006
Messages
76
Hi,
I am trying to filter a report by Form using combo boxes. On the form it contains 5 combo boxes that according to the user's preference it will filter the report.

Below is the code under ONCLICK BUTTON TO SET FILTER:

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![ShipTrack3].Filter = strSQL
Reports![ShipTrack3].FilterOn = True
Else
Reports![ShipTrack3].FilterOn = False
End If
End Sub

Private Sub Command29_Click()
Dim intCounter As Integer

For intCounter = 1 To 5
Me("Filter" & intCounter) = ""
Next
End Sub


the problem is that on the report you have more than five fields, but i set the form to be able to search only using 5 fields from the whole report. When i press filter report it gives me ENTER PARAMETER without any name and then it gives me a null report with no data on it. Something is wrong with this code, can anyone suggest any help.


thanks
 

Users who are viewing this thread

Back
Top Bottom