简体   繁体   中英

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. One line of code in the event field: "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. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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