开发者

Filtering a Listbox based on Combobox selection

开发者 https://www.devze.com 2022-12-30 18:37 出处:网络
I have two tables: Person and Shift Person has as lookup field which is a one to many relationship with Shift.

I have two tables: Person and Shift

Person has as lookup field which is a one to many relationship with Shift.

I would like to create a 开发者_StackOverflowform in which a listbox displaying records from Person is filtered based on the selection of a combobox containing the records from Shift.

in other words, i want to select "days" (value 1) in the combobox, and have only the records from Person that have value 1 in their Shift field displayed in the listbox?

the equivalent sql would be something like:

SELECT * FROM Person WHERE Person.Shift = (the value of the combobox here)

Also, if possible, i would like to do this with little to no VBA as the person i'm passing this off to has no VBA experience and can't be expected to fix bugs in the VBA code.


All you have to do is use the query builder in access and set the criteria to the value of the first combo box

[Forms]![frmMy_form]![cboFirst_combo_box]

Then in the after update event of the first combo box just put

Me.Second_combo_box.Requery
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号