Combo Box input ?

  • Thread starter Thread starter Jay Wilson
  • Start date Start date
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
 
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.
 
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.
 
Back
Top