Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.
' Report will not filter if open, so make sure it is closed If CurrentProject.AllReports(strDoc).IsLoaded Then DoCmd.close acReport, strDoc End If ' This section determines what option the user has selected from the print option group. ' based upon the user selection, it will either Preview, Print or Export to Excel '======================================================================================== If Print_Company_Product_Support.Value = 2 And PrintReport_OptionGroup.Value >= 1 And Len(strWhere) <= 0 Then ' If the select criteria is enabled and the user is trying to print then check that values have been selected MsgBox "Please Select A Value From One of the Dropdown Boxes", vbInformation, "No Filter Criteria Selected!" Else intOptionValue = PrintReport_OptionGroup.Value ' Set variable to the Option group value ' MsgBox intOptionValue ' Display Option variable for TESTING purposes Select Case intOptionValue ' Go through case options and act based upon its value Case 1 ' if preview report is selected then preview ' This is a temporary message while I figure out how to preview such a large report MsgBox "This feature is not yet working due to the size of the report" ' DoCmd.OpenReport strDoc, acViewPreview, , strWhere ' Reports(strDoc).FilterOn = True '----- ' case 2 not yet setup Case 3 ' if Export report is selected then export to Excel DoCmd.OpenReport strDoc, acViewPreview, , strWhere, acIcon Reports(strDoc).FilterOn = True RunCommand acCmdOutputToExcel DoCmd.close acReport, strDoc End Select End If '======================================================================================== Exit_Handler: Exit Sub Err_Handler: If Err.Number <> 2501 Then 'Ignore "Report cancelled" error. MsgBox "Error " & Err.Number & " - " & Err.Description, , "cmdPreview_Click" ElseIf Err.Number = 2451 Then ' Ignore error and reset Err.Clear End If Resume Exit_Handler End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.