We help IT Professionals succeed at work.

MS Access continuous form with dropdown that should show for each row different data depending on value of another field in same row

Bernard Thouin
Bernard Thouin used Ask the Experts™
This is an Access 2013 VBA question.

I have a subform of type continuous form that shows selected rows of data from a table. in the first field I have a kind of record type, say A or B. In the third field, which is shown as a a combobox, I have a value that has to come from two different data sets depending on the record type. I.e.
- if record type is A, then the dropdown in the third field should show a set of values (selected from a separate table, in a column that holds the possible values of the 3rd field  for record type A)
- if record type is B,  then the dropdown in the third field should show a different set of values (selected from the same separate table, in a column that holds the values of the 3rd field  for record type B)

I am really stuck with that user requirement, and don't know if I should have
 - 1 or  2 comboboxes for the 2 record types and ony show one or the other
- 2 separate select statements depending on the type
- and even how to find out, when the row is displayed, if record type is or B.

There doesn't seem to be an event that I can catch when each row is being displayed, so that I could populate the values for the combobox(es) properly depending on the record type

Any idea how I can do what the users want ?

Thanks for help.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Dale FyeOwner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010

Check out my response in this thread
and this example database.

In the sample database, the form "MyContinuous_Working" shows the textbox associated with the second value below the actual combo.  In the "MyContinuous" form, it displays this with the textbox placed over top of the combo.
Software & Systems Engineer
Something is supposed to follow your question ...screenshot ?
If i understood correctly you want to have the combobox to adjust each time depending on the value of Record 1
Anyway i prepared a small sample of how you could tackle this
If the CrucialField = "A" then it goes to Table1 else it goes to Table2..
You can also tweak it to have the combo having as Rowsourse the UnionQUery (ALL) but this depends of what actually is the datatype of the combo...
Bernard ThouinIT Analyst and developer


Hi guys

To be honest, I only looked at John's solution, which was just perfect for me, made a nice generic litte sub out of it, as I had more tan just one control with the same problem, and it works a treat :)

So thanks to both of you for answering so quickly :)