字段值更改时刷新查询驱动的组合框值吗? [英] Refresh query-driven combo box values when field value changes?

查看:73
本文介绍了字段值更改时刷新查询驱动的组合框值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表单上有一个组合框,其中的值是根据单独字段中的值填充的.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆