Check box affecting subform

C

Colin Foster

Sorry for the vague subject!
What I want to be able to do is if a checkbox on my mainform is "ticked",
then I want to restrict the values showing in a lst that is held within a
subform held within the main form. Is this possible?
Regards
Colin Foster
 
P

Pavel Romashkin

Almost everything reasonable is possible :)
In the subform, you can set the list RowSource property depending on the
value of the checkbox. Reference the checkbox using the Parent property
of the subform:

Me.myList.RowSource = "SELECT F1, F2 FROM myTable "
IF Me.Parent.Form.myCheckbox THEN
Me.myList.RowSource = Me.myList.RowSource & " WHERE F3 = 100"
END IF

Cheers,
Pavel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top