
Filter A Report From a Pop-Up Box for Text, Numbers, and Yes/No Field Types
I have a database with three different field types: text, number, and yes/no
(check boxes). These fields are imported from another database which I
cannot control.
I want to give the users the ability to make a report with choices that use
all three types of fields as criteria.
I have copied the method shown in RptSmp97 from Microsoft's Website and
explained at:
http://www.*-*-*.com/
The problem is that this method only works for text fields because it passes
the query to the report with quotes.
How do I change it to work for text, numbers, and yes/no (-1,0)?
Here's the coding:
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![rptCustomersNew].Filter = strSQL
Reports![rptCustomersNew].FilterOn = True
End If
Is there a better way to do this?
Can I change the formatting of the fields temporarily to pull the report?
Any ideas are welcome.
Thanks,
Michelle