link one combo box to another (1 Viewer)

Dgavilanes

Registered User.
Local time
Today, 13:40
Joined
Jun 25, 2001
Messages
109
How can link one combo box to another:
first box list all categories, and combo box 2 list all subcategories based on selection from combobox #1
thanks
 

pdx_man

Just trying to help
Local time
Today, 05:40
Joined
Jan 23, 2001
Messages
1,347
In the recordsource for the second combo box, have criteria referencing the first combo box. You will have to do a form refresh after the first box is selected, but this will work.
 

Dgavilanes

Registered User.
Local time
Today, 13:40
Joined
Jun 25, 2001
Messages
109
combo #1 = Categories
Combo #2 = Subcategories

#1 fields are: Casa; Test; Courses, when I select courses from combo box #1, I would like to see in combo box 2: Math, English, Geography etc.
what criteria can I placed on row source #2 in order to get this
any help will be grealy appreciated
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:40
Joined
Feb 19, 2002
Messages
43,445
Use a query as the row source for combo2 and in that query, use the following as criteria for the category field. Change the Form and control names to those from your form:

Forms![YourFormName]![TheNameOfCombo1]
 

kgcrowther

Registered User.
Local time
Today, 13:40
Joined
Jun 1, 2001
Messages
52
First I would create a table with catagory and sub catagories. Set the primary field as the combonation of the two.

In the first combobox set the row source as a query that looks to the table you created. Right click to turn on the totals so that you get the 'grouped by' in the totals section. (This way it won't repeat repeated items in the combo box) Go to the event 'AfterUpdate' and enter something like:

Me.Combo2.Requery

Go to the second combo box and enter a parameter query as the row source. So the first column in the query biulder is subcatagory (the the show box checked) the second column is the catagory with the totals row reading 'Where' in the criteria enter the parameter "[Forms]![TheName of this form here]![name of combo1 here]"

If this is unclear tell me. I do this a lot of all my forms and it works great.

Kenneth
 

Users who are viewing this thread

Top Bottom