Refresh query-driven combo box values when field value changes?

ms-access

Solution

See whether this description is reasonably close to your situation.

My form has a text box, `txtFoo`, and a combo box, `cboBar`.

The row source property for `cboBar` is a query which references `txtFoo`. And I want the combo's contents updated in response to changes in `txtFoo`. The solution is to requery `cboBar` from `txtFoo's` after update event.

Private Sub txtFoo_AfterUpdate()
    Me.cboBar.Requery
End Sub

Problem

I have a combo box on an form where the values are populated based on the value in a separate field. To do this, I have created a combo box and set the "Row Source" to run a SQL statement. The problem I am having is that if the data in the field changes, the combo box values do not update. How do I get access to re-run the query?

Original source