字段值更改时刷新查询驱动的组合框值吗? [英] Refresh query-driven combo box values when field value changes?
问题描述
我在表单上有一个组合框,其中的值是根据单独字段中的值填充的.
I have a combo box on an form where the values are populated based on the value in a separate field.
为此,我创建了一个组合框并设置行源"以运行SQL语句.
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?
推荐答案
查看此描述是否与您的情况相当接近.
See whether this description is reasonably close to your situation.
我的表单有一个文本框txtFoo
和一个组合框cboBar
.
My form has a text box, txtFoo
, and a combo box, cboBar
.
cboBar
的行源属性是引用txtFoo
的查询.我想根据txtFoo
中的更改更新组合内容.解决方案是在更新事件发生后从txtFoo's
重新查询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
这篇关于字段值更改时刷新查询驱动的组合框值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!