Option Group option deciding list box contents

J

JMorrell

Is it possible for a list box to contain different data sets based on which radio button selected? I have an option group that currently has 2 options, the second one for an item in a list box.

e.g., option 1 produces a report for all employees; option 2 produces a report for all employees for a specific supervisor (which is in the list box); and option 3 prints a report for a specific employee (which is in the list box, now containing employees, not supervisors)

Possible

tia
JMorrell
 
D

Dirk Goldgar

JMorrell said:
Is it possible for a list box to contain different data sets based on
which radio button selected? I have an option group that currently
has 2 options, the second one for an item in a list box.

e.g., option 1 produces a report for all employees; option 2 produces
a report for all employees for a specific supervisor (which is in the
list box); and option 3 prints a report for a specific employee
(which is in the list box, now containing employees, not supervisors)

Possible?

tia,
JMorrell

You can use the AfterUpdate event of the option group frame to change
the RowSource property of the list box; e.g.,

'---- start of example code ----
Private Sub optReportChoice_AfterUpdate()

Select Case Me.optReportChoice

Case 1 ' all employees
Me.lstPeople.RowSource = ""
Me.lstPeople.Enabled = False

Case 2 ' pick supervisor
Me.lstPeople.RowSource = "qrySupervisors"
Me.lstPeople.Enabled = True

Case 3 ' pick supervisor
Me.lstPeople.RowSource = "qryEmployees"
Me.lstPeople.Enabled = True

Case Else
Me.lstPeople.RowSource = ""
Me.lstPeople.Enabled = False

End Select

End Sub
'---- end of example code ----
 

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