Results 1 to 3 of 3
  1. #1
    templeowls is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    305

    Need help with PrintReport VBA

    I inherited a database and there's a form that looks at each complaint individually (its a DB full of customer complaints). There's a print button that allows the user to just print a copy of the complaint. The VBA is below. Because of the way it's coded, it immediately prints the report to the user's default printer. It does not open a print screen dialog to let the user change the printer, change settings, etc.

    Any suggestions on whether it could be altered so that a print dialog opens up?



    Code:
    Private Sub btnPrintComplaint_Click()
    On Error GoTo btnPrintComplaint_Click_Err
    
    
        DoCmd.OpenReport "rptPrintComplaint", acViewNormal, "", "[qryAllComplaints]![ComplaintNumber]= " & Me.[ComplaintNumber], acNormal
    
    
    btnPrintComplaint_Click_Exit:
        Exit Sub
    
    
    btnPrintComplaint_Click_Err:
        MsgBox Error$
        Resume btnPrintEvent_Click_Exit
    
    
    End Sub

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    there are a number of ways - google 'access vba open print dialog' to find links to different ways of doing this.

    Basically you will need code before you open the report, either to create your own dialog box or to display options in the ribbon

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    use: acViewPreview

    DoCmd.OpenReport "rptPrintComplaint", acViewPreview, , "[qryAllComplaints]![ComplaintNumber]= " & Me.[ComplaintNumber]

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

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