Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 347
  • Last Modified:

Cascading Combos

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
DavidGab
Asked:
DavidGab
2 Solutions
 
als315Commented:
Read this Article:
http://www.fontstuff.com/access/acctut10.htm
May be you can upload your DB with sample Data?
0
 
peter57rCommented:
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
 
Helen FeddemaCommented:
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
Helen FeddemaCommented:
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
 
Jeffrey CoachmanCommented:
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
 
DavidGabAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now