首页 > 解决方案 > 执行由第三个组合框列过滤的查询

问题描述

我需要执行由第三个组合框列过滤的查询

我有一个带有以下 rowSource 的组合框(例如):

SELECT Id, Two, Three, Four from AnyTable

绑定列是 Id(我需要它)

另一个组合框需要“三个”字段来使用以下 rowSource 进行过滤(例如):

SELECT IdTable2,Table2Two,Table2Three from AnyTable2 WHERE Table2Three=??????? 'Need to refer to value of column three of first Combo

我尝试了很多解决方案,但不起作用(语法)

我怎么能做到?

提前致谢

标签: vbams-access

解决方案


您需要Column 属性

列索引是从 0 开始的,所以你需要.Column(2)

SELECT IdTable2,Table2Two,Table2Three 
FROM AnyTable2 
WHERE Table2Three = Forms!myForm!myCombobox.Column(2)

推荐阅读