Unanswered: Conditional actions with multiple tables
I have a form which is connected to one main database. There are two fields in this form. One is Issue and one is Sub-Issue. When I pick an Issue from the drop down menu, I want the sub-issue to change accordingly. How do I do this?
You write you second query (the one listed as the rowsource inthe second combo box) to be based on a seelction in the fisrt combo box. The in the after_update event of the first combo box you include the code:
The will refresh the query in the second combo box to be based on the current selection like you are wishing
Here is a way to have a second combo box (perhaps listing products) based on another combo box (perhaps listing companies). Thus after the user chooses a company, he then sees only the products for that company in the second combo box.
For criteria in the 2nd combo box (and to get to the query design mode of the combo box click on the 3 dots just to the right of the combo box's RowSource property):
And for the OnEnter property of the 2nd combo box:
And in any module:
Public Function ctlRequery()
' Purpose: Use this in OnEnter property of a combobox that's based on another control
' that may have changed or based on records that may have changed
' since the form was first opened.
On Error GoTo Err_ctlRequery
' Dim var.
Dim ctl As Control
' Set var.
Set ctl = Screen.ActiveControl
' Requery control.
For an example of dependent combo boxes you can download my sample invoices database currently at http://www.bullschmidt.com/access and then on the Invoices Dialog check out the Invoice # combo box which is based on the Rep # combo box.
One related point is that you probably wouldn't want to allow blanks (i.e. Nulls) in fields that are going to be used with Like in any criteria for that field. Otherwise the blanks wouldn't be shown.