Dependent Combo Boxes

cokeblue8

Registered User.
Local time
Today, 07:28
Joined
Aug 28, 2007
Messages
38
Hi!

I'm a first time Access user and I have a question about cascading combo boxes (I already tried following the other thread about cbo boxes, but no luck):

-I have a main form, frmCommon
-within that I have a sub form, frmCmnDetRew (Common-Details-Rewinder)
-within that I have a sub-sub form, frmCmnProbRew (Common-Problems-Rewinder)
-on the frmCmnProbRew I have two combo boxes, one for the problem category, and one for the problem name.

How do I make it so that the values for the problem name are dependant on the problem category chosen?

PLEASE HELP!!
 

Attachments

base the combobox on a query that is dependant on the problem category
 
I do have a query, which can be viewed when you select the properties of the problem name combo box.

I've been mucking around this morning and resdesigned the whole form, and everything else is fine except the cbo boxes!!!

For the rewinder problem name query I have:

SELECT [tblProbName].[PROB_NAME]
FROM tblProbName
WHERE ((([tblProbName].[CATEGORY_ID])=[Forms]![frmMaster]![frmRew]!cboProbCat));

I think there's something wrong with WHERE clause...but what ???
 

Attachments

hi Ray

I tried that, but no dice.

I thought 'me.' is used in the vba code builder, and not the sql query builder?
 
Check what i did! make sure u dont have the combobox controlsources set .. you can set them later!!!
 

Attachments

wow, thanks a lot, ray!!! :)

just curious, why doesn't it work with the control sources set first?
 
you will have to make sure its saving the correct information where its supposed to be.

as for the control sources. I cant really explain why, someone else can im sure, i just know that when i create a combo box it often makes it so i cant change the value, if the control source is set, so i just set the value later on. pretty simple
 
hey

another issue...but why doesn't the problem (second combo box) match up with the problem categories?? (first combo box)

:confused:
 
im alittle busy first thing this morning,,,, but ill take a look when i get a chance
 
When using cascading Combiboxes the preceding combibox needs to requery the dependency. A Module is another solution I don't use this on subforms so it might need to incorporate the subform name:

Code:
Function LookupProblem()

Dim MyControl As Control
        Set MyControl = Screen.ActiveControl

    With CodeContextObject
    MyControl.RowSource = "SELECT [tblProbName].[PROB_NAME] FROM tblProbName WHERE [tblProbName].[CATEGORY_ID]=.cboProbCat;"
    End With

Simon
 
Here. They match up now. you'll have to add the category 6 or 7 or 8
 

Attachments

Don't know if you've solved everything, but I had a similar problem that required a "requery" command in VBA. Until the Requery was set, the cascading cbo's didn't work correctly.
 
remade your product category combo box so that it found the category ID and catname only. then using the catID made the product combo box dependant on that
 

Users who are viewing this thread

Back
Top Bottom