How do I validate an option group on a form through a command button? (Print, button for example) Do I have to have multiple reports or multiple queries?
I would like to be able to click a Command Button, labeled Print, that resolves on an option group. Within my option group, I have radio buttons such as; Date, Customer, Status, and Employee. When I click on the Employee Radio Button and then click on print, I would like it to call the employee report I have created and preview/print that report.
Yes it does. Each option in your Option group has a value which is a number. You can use a select case statement to select the appropriate report. Use the command button wizard and just make the print button go to any report in your database. Now go into the code window and you'll see a line that says:
stDocName = "ReportNameThatYouPicked"
Delete that line and replace it with your Select Case statement like this:
[tt]
Select Case MyOptionGroupName
Case 1
stDocName = "DateReportName"
Case 2
stDocName = "CustomerReportName"
Case 3
stDocName = "StatusReportName"
Case 4
stDocName = "EmployeeReportName"
End Select
[/tt]
Items in blue are the ones you need to change to match your situation. The 1,2,3,4 is a matchup of the value in your option group so check what number goes with which radio button.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.