Access 2010
Access 2003
Seminars
Tips & Tricks
Access Forum
Course Index Insider Circle
 
Tutorials   News   Tips   Forums   Help   Logon   Order  
 
     
 
Tips & Tricks

New Tips Added Weekly!
Click here to get on our Mailing List

   

  Access   Excel   Word   Windows   FrontPage   Hardware   Misc

 

Filtered Combo Boxes

Updating the records in one combo box based on the value selected in another.

Q: I have two combo boxes on my form. When the user selects a value in Combo Box One, I need to filter the list in Combo Box Two. For example, if the first combo box has a list of States, then I want Combo Box Two to show only cities from the state chosen in Combo Box One.

A: I get asked this question all the time. This is NOT easy to do, but it can be done. You need to know how to make a combo box, how to get a query critiera from a form field, and how to create an AfterUpdate event. Once you've mastered those techniques, you're ready to move on to this lesson.

Here is a FREE VIDEO TUTORIAL that will walk you through an example of working with multiple combo boxes. It's much easier to show you how it's done than to explain it here.

I teach the concepts in this free mini tutorial in my Access 307 course. These are full courses - over 60 minutes in length each. I spend a lot more time going over how to do this, in addition to lots more tips and tricks.


UPDATE:

A customer has told me she's trying to cascade combo boxes in a SUBFORM. This adds a bit of complexity to the problem, but it can be done with a slightly different approach. Here's what I did. I used the same kind of setup, but in the RowSource for the CityCombo box, I used this SQL statement instead of a query:

SELECT City FROM CityT WHERE State=[StateCombo];

This removes the need for the query with the parameter. The query works fine for a single form solution, but when you're dealing with a continuous form or a SUBFORM, then you have to have each combo box deal with it's own record. In this case the "State=[StateCombo]" says for each record to look over at the value of the StateCombo box and fill in that value here for my record list.

But we're not done yet. Now, when you move from record to record, you need to make sure you update the CityCombo box's list of cities. So you need to put this in the CityCombo's OnGotFocus event:

CityCombo.Requery

Now this will force the CITY combo box to requery itself whenever you drop the box down. It will look over at the current State and show you only these records. Here's what I end up with:

It works PERFECTLY for me, and this solution is completely independent. It doesn't rely on any queries, nor any fields on the parent form.

 

 

You may want to read these articles from the 599CD News:

 

 
Learn
 
Microsoft Access
Microsoft Excel
Microsoft Word
Microsoft Windows
Microsoft PowerPoint
Adobe Photoshop
Visual Basic
Active Server Pages
Online Seminars
More...
Customers
 
Account Login
Online Theater
Downloads
Lost Password
WalkThru Tutorials
Free Upgrades
Insider Circle
Info
 
Latest News
New Releases
User Forums
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Help
 
Live Chat
Customer Support
Troubleshooting
FAQs
TechHelp
Consulting Services
About Us
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Order
 
Video Tutorials
Handbooks
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Live Chat
General Contact Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Try Us
 
Free Lessons
Online Theater
Mailing List
Course Indexes:   Microsoft Access   Microsoft Excel   Microsoft Word   Microsoft PowerPoint   Visual Basic (VB)   Photoshop   Active Server Pages (ASP)  
Keyword Search Cloud:   What's This?   courses   microsoft access tutorials   vlookup   access   cartesian   excel   dlookup   vba   attendance   access 2007   sql   windows 7   combo box   pivot table   visual basic   test   iif   word   calendar   query   conditional formatting   pivot tables   photoshop   hlookup   access 101   excel 202   excel 2007   student attendance   update query   my account   word 2007   append query   quickbooks   queries   dsum   reports   powerpoint   if   microsoft access   dmax   mail merge   relationships   ms access   access 2010   vb   dcount   subforms   excel 2003   handbooks   html   599cd   combobox   if function   security   microsoft word   after update  
Copyright 2012 by 599CD.com, All Rights Reserved