Combo Box input ?

J

Jay Wilson

I have a form that has 2 combo boxes on it. I want the list items for
combox2 to dynamic change based on what is selected from combox1. Combox1
is based on Table/Query of a table called "classes" and combox2 is based on
a Table/Query of a table called "instructors".

I know this is possible, I had it working about 1 year ago before blowing
up my system. If I recall correctly, there might be some VB coding
involved. I only use Access once a year for a Boy Scout event.

Thanks
 
F

fredg

I have a form that has 2 combo boxes on it. I want the list items for
combox2 to dynamic change based on what is selected from combox1. Combox1
is based on Table/Query of a table called "classes" and combox2 is based on
a Table/Query of a table called "instructors".

I know this is possible, I had it working about 1 year ago before blowing
up my system. If I recall correctly, there might be some VB coding
involved. I only use Access once a year for a Boy Scout event.

Thanks

Leave the rowsource of the 2nd combo box blank.
Code the AfterUpdate event of the 1st combo box to fill the rowsource
of the 2nd.
Something like this:
Combo2.Rowsource = "Select Instructors.InstructorID,
Instructors.InstructorName from Instructors Where Instructors.ClassID
= " & Me!ComboName & ";"

Change the table and field names as needed.
The above assumes ClassID is a Number datatype and the combo box bound
column is Number also.
 
P

Penguin

In the AfterUpdate of the ComboBox1 use an SQL statement that filters
the records based on a selection from the this combo box. Something
like:

Me!ComboBox2.RowSource = "SELECT * FROM Table WHERE [ID] ='" &
Me!ComboBox1 & "';"

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top