Results 1 to 3 of 3
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,185

    Run Time error 2051

    Hi Guy's i can't find this issue, i am getting a run time error on output report ?

    The files are in the path
    I have a criteria on the paths as there is a different report to outpout depending on name so:



    The Output to was cancelled run time error 2051

    Code:
    If Right(Me.txtInvoiceTo,2) = "BV" Then
    InvPath = "T:\Customer BV\Invoices\"
    DoCmd.OutputTo acOutputReport, "rptInvoiceBV", acFormatPDF, InvPath & "Invoice" & " " & Me.txtInvoiceNumber & ".pdf", True
    End IF
    If Right(Me.txtInvoiceTo,2) <> "BV" Then
    InvPath = "T:\Customer\Invoices\"
    DoCmd.OutputTo acOutputReport, "rptInvoice7", acFormatPDF, InvPath & "Invoice" & " " & Me.txtInvoiceNumber & ".pdf", True
    End IF

  2. #2
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,185
    I think i may have solved it, i have the path wrong!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!

    Thanks for looking

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    Might want to say what error description is as well next time?
    Not everyone knows them off by heart.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 3
    Last Post: 04-06-2021, 06:25 AM
  2. Replies: 6
    Last Post: 02-03-2020, 07:09 PM
  3. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  4. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 PM

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