0
votes

enter code hereI have this filtering form that has a toggle button. The toggle button has a series of different on buttons that represent different reports. The function of the toggle button is for the user to select which filters are active based on what is relevant to the selected report. I have a button on the bottom of the form that filters the report based on what is selected in the toggle as well as the filtering criteria. How would I go about opening the report based on the toggle selected?

  Dim rptName As String
    Select Case Me.yourOptionGroupFrameName
 Case 1
 rptOnboardParity = "TheReportForOption 1"
 Case 2
 rpCompletedExit = "TheReportForOption 2"
 Case 3
 Under Construction = "TheReportForOption 3"
 Case 4
 rptApplicantArchive = "TheReportForOption 4"
 Case 5
 rptSalaryIncreases
 Case 6
 rptEducation
 Case Else
 MsgBox "Not a valid Option", vbInformation
 Exit Sub
 End Select
 DoCmd.OpenReport rptName

This is along the lines of what I was thinking for the toggle frame. I have my filter boxes and a button to filter based on those boxes but I do not know how to filter based on those boxes and open the report based on what is pressed in the toggle frame

1
You could use the report's filter feature or you could use the toggles to modify a query that the report is based on. - Jeffrey
@Jeffrey I am having the issue of connecting what is in the toggle frame, the textboxes that are used to filter and the button used to filter and open the report. - Tyrone

1 Answers

0
votes

First what you want to do is to set the option value for each toggle in your option group. When the options are selected by the user, it will change the value of that option group's frame. So you can use your switch statement to check the value of the frame. It looks like all you need to do is change the case statement to:

Select Case Me.yourOptionGroupFrameName.Value