List filtering based on Combobox selection

I have two tables: Person and Shift

A person has a search field, which is the relationship to each other with Shift.

I would like to create a form in which a list that displays entries from Person is filtered based on a selection of a drop-down list containing entries from Shift.

In other words, I want to select "days" (value 1) in the combobox and only have entries from Person that have a value of 1 in my Shift field displayed in the list?

equivalent sql will look something like this:

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

In addition, if possible, I would like to do this with a slight lack of VBA, since the person with whom I pass this does not have experience with VBA and cannot wait to correct errors in VBA code.

+3
source share
1 answer

All you have to do is use the access query builder and set the criteria for the value of the first combined block

[Forms]![frmMy_form]![cboFirst_combo_box]

Then in the event after updating the first combo box just put

Me.Second_combo_box.Requery
+5
source

Source: https://habr.com/ru/post/1746311/


All Articles