Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter Report with multiple check boxes 1

Status
Not open for further replies.

sqlJunior

Technical User
Sep 22, 2002
123
TH
I have been filtering a report by using a single check box on a form and an associated combo box. I use the following code in the report module with the reports onOpen event:

If (Forms![xyz]![chk1]) = True Then
Me.Filter = "[Item1] = Forms![xyz]![cbo1]"
Me.FilterOn = True
End If

However, I now need to use 4 check boxes on the form (and associated combo's) but I don't know how to write the code in the report module so that it will apply the 4 filter criteria.

Can anybody help?
 
Hi

there are several ways to do this but at its most simple:

strLink1 = ""
If (Forms![xyz]![chk1]) = True Then
Me.Filter = "[Item1] = Forms![xyz]![cbo1]"
Me.FilterOn = True
strLink1 = " AND "
End If
'
If (Forms![xyz]![chk2]) = True Then
Me.Filter = Me.Filter & strLink1 & "[Item2] = Forms![xyz]![cbo2]"
Me.FilterOn = True
End If
...etc for the other check boxes


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 

Thanks KenReay,

It works perfect.
And the fact that its so simple makes it even better.

Really appreciate your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top