Option Group option deciding list box contents

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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 ----
 
Back
Top