I have a report generated which displays all relevant data from the dataset.
A filter form is used to filter down to specific data using one, two, or three filters as the user determines. The number of pages in the report changes based on the criteria chosen.
On the Print action I want to have a Message Box display a warning to the user about the size of the report eg. “This report comprises 256 pages, do you want to want to proceed.” Then I want the options of [OK/Proceed] and [Cancel] buttons.
I want the Message to reflect the Report’s Number of Pages which will change with each search criteria so that after changing the search criteria, the message might say “This report comprises 25 pages, do you want to want to proceed.”
What is the easiest way to do this?
My current Code is:
[Private Sub b_PrntDialog_Click()
On Error GoTo Err_b_PrntDialog_Click
'Hide the Report Search/Print dialog form
Forms![f_PrintDialog-SearchMisc1].Visible = False
'Selects the Report
DoCmd.SelectObject acReport, "r_1ProfsCtsMiscSearch1"
' Destination is printer dialog
DoCmd.RunCommand acCmdPrint
' Re-opens Report Search/Print dialog form
Forms![f_PrintDialog-SearchMisc1].Visible = True
Exit_b_PrntDialog_Click:
Forms![f_PrintDialog-SearchMisc1].Visible = True
Exit Sub
Err_b_PrntDialog_Click:
Resume Exit_b_PrntDialog_Click
End Sub]
Ideally the Message Box should display first on the click action, then if [OK/Proceed] button is selected, the action proceeds to the <DoCmd.RunCommand acCmdPrint> action.
If the [Cancel] button is selected, it Cancels the actions and goes to the <Exit> action and returns to the report and Search/Print dialog form.
Any assistance appreciated.
Many thanks
mortonsafari