kbakalar
11-20-2003, 02:08 PM
I need to formulate a query for a combo box that takes into account the value in a yes/no checkbox that is on the same form. I would like to write a conditional "where", conditional on the value of the checkbox. If the checkbox is Yes, I want to use one where condition; if the box is No I want to use a different where condition.
dcx693
11-21-2003, 06:45 AM
Do you mean basing the rowsource of the combo box on whether or not the checkbox is checked?
kbakalar
11-21-2003, 10:44 AM
Yes, the query in the rowsource of the combo box.
dcx693
11-21-2003, 11:07 AM
Place some code in the After Update event of the combo box that alters the rowsource property of the combo box. Something like:If Me.chkBox Then
Me.combo.Rowsource="SELECT Name FROM tbl WHERE Active=True;"
Else
Me.combo.Rowsource="SELECT Name FROM tbl WHERE Active=False;"
End If
kbakalar
11-22-2003, 08:20 PM
Many thanks. It seems obvious -- once someone tells you how.