Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 13th, 2006, 03:09 PM
Registered User
 
Join Date: Nov 2006
Location: , , USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Subform Filter based on Multiselect Combo boxes

Hi All,

I'm a newbie in terms of Access and some of its functionality . I've been stuck on this problem for a couple days, even after searching the Web, etc.

Currently I have five combo boxes that are multiselects in my main form. I need to use these combo boxes to filter a subform within my main form.

My combo boxes are as follows:
1. A - 4 select options
2. B - 10 select options
3. C - 4 select options
4. D - 3 select options
5. E - 4 select options

My subform is a listing of all the possible combinations of these select options (therefore there are 4 x 10 x 4 x 3 x 4 records).

I am having trouble understanding how to link these unbound combo boxes to the subform to make the filter work once a user has selected their options from the 5 combo boxes.

Case example:
If I select option 1, 2, and 3 from combo box A, and options 2 from combo box B, C, D, and E; I would want the subform to filter based on this query:


SELECT * FROM TABLE WHERE
(A_id = 1 OR A_id = 2 OR A_id = 3) AND
B_id = 2 AND
C_id = 2 AND
D_id = 2 AND
E_id = 2;


I hope this makes sense. Can anyone please help me out on this one. I'd be indebted to you! I really appreciate it

Any help on which functions or what code to put and where to put it would be great!

Thanks,
Nate


Reply With Quote
  #2 (permalink)  
Old November 14th, 2006, 08:42 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   Create the query for your subform in the query designer. Then, for each field in the query that will be filtered by the combo boxes, enter this code on the Criteria line in the query:

[Forms]![frmMyForm].[cboMyCombo1]
[Forms]![frmMyForm].[cboMyCombo2]
[Forms]![frmMyForm].[cboMyCombo3]
...

   Make sure the combo boxes are bound to the same column that you are calling from the query criteria. Also, make sure the combo boxes have a default selection.

   Then use a button or a combo event to requery the subform.

Does that help?



mmcdonal
Reply With Quote
  #3 (permalink)  
Old November 16th, 2006, 10:05 AM
Registered User
 
Join Date: Nov 2006
Location: , , USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great! Thanks so much it helps :) I really appreciate it!

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subform Filter using Multiple Combo boxes natwong BOOK: Expert One-on-One Access Application Development 0 November 13th, 2006 03:07 PM
Filter a subform based on value entered mackoy Access 1 August 25th, 2006 12:27 PM
Filter by Combo Boxes Corey Access VBA 5 June 1st, 2006 07:33 PM
Using check boxes to filter dstein4d Access VBA 13 January 25th, 2006 07:50 PM
Filter Subform B Based on Field in Subform A SerranoG Access VBA 3 June 18th, 2004 12:23 AM



All times are GMT -4. The time now is 07:04 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.