Solved

Cascading Combos

Posted on 2012-03-12
6
318 Views
Last Modified: 2012-03-13
I'm trying to create a simple Access database that allows me to use a form to enter vehicle information quickly by using cascading combo boxes. I need a "Year" combo box to drop down a list of vehicle years (say 1987 thru 2012), a "Make" combo box to drop down all of the diferent vehicle manufacturers available for the chosen "Year", and a "Model" combo box to drop down the available models for the chosen "Make".

I'm lost on the task of getting the data in the "Make" combo box to update based on the chosen "Year", and the data in the "Model" combo box to update based on the chosen "Make". I'm just starting out on this project and I have limited experience working with Access (or any other database software), and very limited experience working with code. Should I be using a different application for this project, say Visual Studio?
0
Comment
Question by:DavidGab
6 Comments
 
LVL 40

Assisted Solution

by:als315
als315 earned 250 total points
ID: 37713181
Read this Article:
http://www.fontstuff.com/access/acctut10.htm
May be you can upload your DB with sample Data?
0
 
LVL 77

Expert Comment

by:peter57r
ID: 37713538
Pesonally I don't see how Year leads to Make.   I would regard Year as a piece of data about the vehicle.

But you must have a table that includes all the combinations of Make and Model that you want to see in your list.  You can also have a separate table of Make as well but that is not strictly necessary for this question.

You base the Make combo (cboMake) on a query which is :
Select Distinct Make from tblMakeModel order by Make

You then base the Model combo (cboModel) on a query which is your version of:
Select Model from tblMakeModel where Make = Forms!YOURFormName!cboMake order by Model

To get the cboModel to update its list when cboMake changes you must use the Afterupdate event procedure of cboMake.
You need one  line of code added to the procedure.

Me!cboModel.Requery

As I said, I think Year is a piece of data about the vehicle.  It can be selected from a simple list of year numbers (stored in a table) although I'm not sure why you are not recording the registration date in full.
0
 
LVL 31

Accepted Solution

by:
Helen_Feddema earned 250 total points
ID: 37716711
Fancy Filters formHere is a typical linked (or cascading) combo box setup:

cboSelectCustomer has tblCustomers as its row source.  Its AfterUpdate event sets cboSelectOrder to Null or "", and requeries cboSelectOrder.
cboSelectOrder has tblOrders as its row source, with a criterion of [Forms]![frmSelectOrder]![cboSelectCustomer]

However, as others have said, this may not be what you need.  See my Fancy Filters sample database for examples of creating concatenated filters with data of various types:

http://www.helenfeddema.com/Files/accarch129.zip

I think you might need a set of 4 linked combo boxes -- one for Year, one for Manufacturer (you don't have this now), one for Make and one for Model.  It depends on whether Year is an independent value, or the years that are selected are each linked to a set of manufacturers for that year.
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 37716722
For the 4 linked combo boxes, selecting Year would requery the list of manufacturers, selecting the manufacturer would requery the list of makes, and selecting a make would requery the list of models.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37716870
Pete.
<Pesonally I don't see how Year leads to Make.   I would regard Year as a piece of data about the vehicle.>

I agree.

What I think the OP needs here is a system that mimics the actual line of questioning a Customer might have to go through.
Typically when you bring your car in for service, you are asked for :
Year, Make, then Model
Most people in the US, when asked what kind of car they drive will reply in that order.
For example, If someone asked me, I would reply: 2005, Ford, Taurus

<LOL, but that is for the US.
Remember we are the ones who use the rather odd "mm/dd/YYYY" date format...>
;-)

So I think they just needed to understand the logic behind a three level cascading combobox system.

But yes, I do agree that it would be more logical to select the Make, Model, then Year...

;-)

Jeff
0
 

Author Closing Comment

by:DavidGab
ID: 37718110
Excellent solutions! The three level cascade is exactly what I want (Year, Make, Model), in that order if possible (I originally wrote manufacturer, but I meant "make"). Just to clear up the concerns about "Year" being independent data, I'd like to filter as much of the data as possible and an example would be the various drops in "Makes" recently (Oldsmobile, Pontiac, Saturn, etc.). For example, if I didn't use Year in the cascade and I were to choose 2009, the Make combo would still show Pontiac in the drop down, even though they do not exist anymore.

It will take me a few days to dissect the information above, especially the example .mdb file, but I think the solutions provided will definitely get the job done. I'll upload what I have so far - but I haven't applied the solutions yet. Suggestions are always welcome. Thanks, everyone here has been very helpful!
Vehicle-Management-System.accdb
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question