Results 1 to 2 of 2
  1. #1
    mortonsafari is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2015
    Location
    Brisbane, Queensland, Australia
    Posts
    39

    Message Box to display warning of (varying) number of pages in report before print

    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

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    pvRpt = "rFacilities"
    DoCmd.OpenReport pvRpt, acViewPreview, , , acHidden
    MsgBox Reports(pvRpt).Pages
    DoCmd.Close acReport, pvRpt, acSaveNo

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 07-24-2015, 11:24 AM
  2. Pop Message Box Warning
    By data808 in forum Programming
    Replies: 4
    Last Post: 01-11-2014, 04:43 PM
  3. Replies: 3
    Last Post: 03-11-2013, 05:11 PM
  4. Replies: 2
    Last Post: 02-08-2012, 01:03 PM
  5. Access warning message
    By John Southern in forum Access
    Replies: 2
    Last Post: 05-28-2010, 06:01 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums