简体   繁体   English

更新后的MS Access组合框子窗体筛选器

[英]MS Access combo box subform filter afterupdate

I have a combo box, when I select a value, I would like the subform to filter on a particular field with that respective value. 我有一个组合框,当我选择一个值时,我希望子窗体在具有该值的特定字段上进行过滤。

I cannot figure out how to get the Macro Action Builder on After update to function correctly, so I am trying some vba in the afterupdate event field for the combo box. 我无法弄清楚如何使“更新后的宏操作生成器”正常运行,因此我在组合框的afterupdate事件字段中尝试了一些vba。 One line of code in the event field: "SELECT * FROM [fsubtotal] WHERE [Fund Codes] = " & cbo1.Column(0) 事件字段中的一行代码:“ SELECT * FROM [fsubtotal] WHERE [Fund Codes] =”&cbo1.Column(0)

fsubtotal is my subform and Fund Codes is the Field I want to apply the filter to. fsubtotal是我的子表单,Fund Codes是我要对其应用过滤器的字段。 I'm not sure if I should use 0 or 1 for Column(x), as 0 is the key ID in auto number format, but 1 would be the actual fund codes in short text format. 我不确定是否应该对Column(x)使用0或1,因为0是自动数字格式的键ID,但是1是短文本格式的实际资金代码。

You should be able to link the subform to the combo box in question by selecting the subform container, and then in the property sheet, going to Data -> Link Master Fields. 通过选择子窗体容器,然后在属性表中,转到数据->链接主字段,您应该能够将子窗体链接到相关的组合框。 The master field is whatever field you want to connect from the master form. 主字段是您要从主表单连接的任何字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM