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

    Opening Print Dialog Box from pop-up form associated with report preview

    I have a DB (Access 2007) set up so that users do not have access to the Menus or ribbon.
    On the Switchboard I have an option button which opens a report in Print Preview mode, as well as a small form (Print Dialog form) relevant to the previewed report with Buttons “OK”, which gives the user an option to Print (sends straight to default printer), or “Close Report” which Cancels (closes the report preview and the small Form).

    The code for the actions for the “OK” button are as shown below:

    [Private Sub Print_Reports_Click()
    Dim ReportDest As String
    ReportDest = acNormal



    'Hide the Report Print Dialog
    Forms![f_PrintDialog-WaitList].Visible = False

    ' Destination is printer
    DoCmd.OpenReport "r_WaitList", ReportDest, , , acWindowNormal

    ' Re-opens dialog box
    Forms![f_PrintDialog-WaitList].Visible = True

    End Sub]

    This works well to Print to the default printer.

    What I want to do is the have the Printer Dialog Box show so that users can select a choice of printer, or select which page/pages to print.

    What do I need to include, what do I need to change and where do I need to put it?

    Any help appreciated.

    Many thanks.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Give the following a test.

    Private Sub Print_Reports_Click()
    DoCmd.RunCommand acCmdPrint
    End Sub

    Will probably have to include error handler code to deal with error when user cancels print.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mortonsafari is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2015
    Location
    Brisbane, Queensland, Australia
    Posts
    39
    Thanks for your response.

    I have adjusted the code to -

    [Private Sub Print_Reports_Click()
    Forms![f_PrintDialog-Letters].Visible = False
    ' Destination is printer
    DoCmd.RunCommand acCmdPrint

    ' Re-opens dialog box
    Forms![f_PrintDialog-Letters].Visible = True

    End Sub]

    and while it gives me the Print Dialog Box, it only prints a copy of the Switchboard page and not the report.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Okay, just did some testing. Have to return focus to the report.

    DoCmd.SelectObject acReport, "report name"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    mortonsafari is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2015
    Location
    Brisbane, Queensland, Australia
    Posts
    39
    Thanks for your assistance. I have added an extra button. Worked a treat as shown below . .

    [Private Sub b_PrntDialog_Click()

    'Hide the Report Print Dialog
    Forms![f_PrintDialog-Letters].Visible = False
    'Selects the Report
    DoCmd.SelectObject acReport, "r_Letters2Write"
    ' Destination is printer
    DoCmd.RunCommand acCmdPrint
    ' Re-opens dialog box
    Forms![f_PrintDialog-Letters].Visible = True

    End Sub]

    Again - Thanks.

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

Similar Threads

  1. Replies: 5
    Last Post: 08-06-2015, 03:26 PM
  2. Replies: 1
    Last Post: 02-21-2015, 11:35 PM
  3. Replies: 6
    Last Post: 03-01-2014, 07:07 AM
  4. Replies: 1
    Last Post: 02-23-2013, 12:30 AM
  5. Replies: 1
    Last Post: 10-20-2011, 01:34 PM

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