How could you set the selections available in a MS Access form combo box to be dependent on the selection made in a previous combo box? |
Answer
I haven't used Microsoft Access in a while but I think you would have to modify the action properties of the combo box (i.e. you select choice 1 from the first combo box, then choices a,b and c appear in the second combo box).
Answer
In the second combo box's row source property add a reference to the first combo box in the criteria section of the field that matches the first combo box.
For example, if the first combo box is bound to the field Table1ID, and combo box 2 is going to use that value to select records to display, based on records that match combo box 2's table's FKField value, then you would:
a) go into the Combo Box 2 row source
b) add the table's FKField (or whatever it's called) to the query (unless it's already there)
c) and in the criteria row under the FKField, add:
[Forms]![FormWithComboBoxes]![ComboBox1]!Table1ID
(replace the above names with the specific names; you can also use the expression builder to get that expression).
d) Then, in Combo Box 1's AfterUpdate event, add the following lines of code:
Me.ComboBox2 = Requery Me.ComboBox2 = Null
And that should do it. Hope that helps.
|
|
|
First answer by Adam. Last edit by Ngins. Contributor trust: 59 [recommend contributor]. Question popularity: 176 [recommend question]
|
Research your answer: |
Can you answer other questions about software and apps?
|
|


