开发者

Filtering a Listbox based on Combobox selection

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜