By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,519 Members | 2,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,519 IT Pros & Developers. It's quick & easy.

Filter by multiple combo boxes

P: 23
Hi guys,

I was wondering if someone could give me some insight on this. On a form I would like to have 3 combo boxes which can be used as filters. I would like the information to be displayed on a Subform/Subreport and then be able to print a report. For example Filter1, list the company name. Filter2 list the options (open, close). Filter3 is related to the company acct balance, the options are (<$1000, >$1000, >$5000).
I would like to be able to select the company, then view only the open or close accts then select what balances I want to view.
I have created filters on a form before but not on subform. The code I would use for Filter1 and Filter2 is below.

Private Sub Filter1_AfterUpdate()
Dim strFilter As String
strFilter = "select * from [Comp_Info] WHERE [CompName]= " & CboName & ";"
Me.RecordSource = strFilter
End Sub

To create filter3, I am not sure how to go about doing that. If the code above is good for filters 1 & 2, how do I link the filters so that I can filter from one to the other?
How should I approach the subform? I was thinking creating a query with all the companies info and then use the filters to view what accounts I want.
Any help would be greatly appreciated. Thanks in advance.
Jan 15 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 31,494
You're on the right lines but with your three (unbound) filters, you want to have AfterUpdate event procedures for each but all should call a single procedure (MakeFilter) which would then set up a Filter string (strFilter). There is an example of something similar in (Check Boxes to Pass into Query ).
Jan 16 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.