Cascading Combo Box

pam0566

Registered User.
Local time
Yesterday, 23:42
Joined
Jun 6, 2008
Messages
132
I am trying to do a simple [or so i thought] cascade combo box. I have a table called MAKEMODEL [compised of car makes and car models] a table called MAKE [you got it .. car Makes Only], and am tryin to set up a cascading combo box that when you select the correct MAKE, the models will ONLY show up that correspond to that make. The CBOMAKE [make combo box] is based off the Make table, and works great. I cant get values on the model box at all. For examble, i want to select LEXUS off the make combo box, and only have Lexus Model Cars showing. HELP> can anyone help me out? i have tried 20 diff ways and not getting it to work.... thanks for any help you can give!
 
First, you should have a make table and a model table (normalized data - 1 to many)

Normalize.png
 
I have a MAKE table listing vehicle Makes / and a MAKEMODEL table showing both makes and models, with a 1 to many relationship.
 
ANy other input? i am getting frustrated with this!
 
It's a table which ties them together, yes. You store the index number of the make with the model:

tblMake
MakeID - Autonumber (Primary Key)
MakeDescription - Text

tblModel
ModelID - Autonumber(Primary Key)
MakeID - Long Integer (Foreign Key)
ModelDescription
 
The tables and the relationship are set up that way. The CboMake works fine.. shows only the list of "Makes" listed in the MAKE table.. What i want to do is have only teh models show in the cboModel that correspond with that make i already selected. Thats the part that isnt working. i get a nothing field when i try to do this. Tables and relationship appear to be correct, it has to be something i am doing wrong in the EVENT .. read a few things.. one change the row source on cboMODEL, that didnt work, also tried to change the after click even on cboMake, that didnt work either. :(:mad:
 
Ok, I will work on that this afternoon. dont have my laptop with me, and that is where it is stored right now. will get back to you.. THANK YOU! hope it works!!!
 
ok, hopefully I uploaded this right. I saw your example, and i thought that everything matched, but still having problems. I appreciate your offer of taking a look... disregard the formatting... i gave up until i get the make and model fields working right. Thanks again in advance for ALL your help! hope i attached this right.:D
 

Attachments

HI.. anyone have any ideas.. struggling over here! Thanks!
 
For starters, you're requerying the wrong combo in the after update event of the first. Second, your SQL for the second combo is all messed up. Try this:

SELECT tblmakemodel.model AS Expr1 FROM tblmakemodel WHERE [make]=[Forms]![frmvehicles].[cbomake] ORDER BY model;
 
Okay, I just fixed it for you. Your relationships were messed up, your tables not designed right and the form wasn't storing the ID and not the text like it should. The query for the Models has the make as criteria.
 

Attachments

not to sound dumb :) but my brain is fried with all this.. where should i submit that? as an event procedure on the cbomake after click? or row source on cbomodel? thanks!
 
just saw last post. will open my copy.. thanks for help!!!! you are great!
 
hi.. ok i opened my frmvehicles.. the last car "lexus" shows in teh cbomodel only the lexus models.. but if i change lexus, or go to new record and add another make /vehicle.. it still only shows the 2 lexus models. Can you help me with this? thanks!!!
 
ok i think i actually fixed it.. :), i changed the cbomake to cbomodel in the after click event on cbomake to requery the cbomodel. it seems to be working.. going to play with it a little.. .thx SOOO much!
 
Ok, Problem. When I Enter The Car. I Select The "make" [lexus], And I See The 2 Diff Lexus Models Under Cbomodel. Then I Go To My Next Car.. I Can Enter A New Car.. But If I Go Back Then I See Only The Model Info On The Lexus. Not The New Car [for Example Buick Lacrosse] That I Entered. Any Ideas?
 

Attachments

I don't know why it isn't working but I solved it by putting

Me.cboModel.Requery

in the Form's On Current event.
 
if i do that.. on the FORM Page properties.. i get Microsoft Access cant find the object 'ME',. did you mean the cbomake or cbomodel on current?
 

Users who are viewing this thread

Back
Top Bottom