Listbox Source

L

Lewis M

How do I use an option group to select a row source and filter the data for a
listbox? I have a form with a listbox and an option group with two options .
When my users select an option, I want that action to set the row source,
filter the data then fill the listbox. Thanks for any assistance.
 
O

Ofer Cohen

On the After Update event of the OptionGroup you can write something like

Select Case Me.OptionGroupName
Case 1
Me.ListBoxName.RowSource = "Select * From TableName Where FieldName =
111"
Case 2
Me.ListBoxName.RowSource = "Select * From TableName Where FieldName =
222"
End Select
Me.ListBoxName.Requery
 
L

Lewis M

This was very helpful; it worked just fine. I only added single quotes
around the field values. Thank you!
 
Top