In the after update event of the check box, you would have code to
assign an sql statement or a saved query as the row source.
Private Sub myCheckBox_AfterUpdate()
If ME.MyCheckbox = True then
Me.MyListbox.RowSource="SELECT FieldA FROM TableA Order by FieldA"
' If you are using a query then
Me.MyListbox.RowSource = "NameOfSavedQuery_A"
Else
Me.MyListbox.RowSource="SELECT FieldB FROM TableB Order by FieldB"
' If you are using a query then
Me.MyListbox.RowSource = "NameOfSavedQuery_B"
End If
'If you might want to clear the selection
Me.MyListBox = Null
End Sub
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
So put code in the form's Open event (or Current event) to set the listbox
appropriately. The Current event is probably most appropriate if the listbox
needs to have a value dependent on the checkbox's state, as you move from
record to record.
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.