Listbox Source

G

Guest

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.
 
G

Guest

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
 
G

Guest

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

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