Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    School Boy Error is offline Advanced Beginner
    Windows 7 32bit Access 2013 64bit
    Join Date
    Oct 2012
    Posts
    72

    Runtime error 2059


    Hi, I have a report based on a query that appears on screen exaclty as expected. It has a button with one line of VBA to export the report to a pdf and I am getting the error:Run time error '2059'Cause for Concern Log cannot find the object '/1'The vba code is simply:
    Code:
    DoCmd.OutputTo acOutputReport, "Green Form Summary", acFormatPDF, "", False
    Which works fine on the other report I have so I don't know what the difference is....

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    almost certainly it will be something in your Green Form Summary report. Possibly some code trying to update a control called /1

  3. #3
    School Boy Error is offline Advanced Beginner
    Windows 7 32bit Access 2013 64bit
    Join Date
    Oct 2012
    Posts
    72
    I've looked through the property sheet but can't seem to find anything. The labels etc that refer to elements in the report all refer properly (as far as I can see). Any ideas of where I might look further?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Shot in the dark, but does the report refer to a form that gets closed after the report is opened?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    School Boy Error is offline Advanced Beginner
    Windows 7 32bit Access 2013 64bit
    Join Date
    Oct 2012
    Posts
    72
    No, the form stays open and needs to be manually closed behind it...

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The same error https://access-programmers.co.uk/for...d.php?t=263516

    "That particular error almost always means that some error has occurred in the form or report you were trying to output based on having named something in the form's RECORDSOURCE query or on a control's ROWSOURCE query, when you spelled the object wrong or named an object that didn't appear in the referenced query's underlying recordset.

    I.e. the query processor failed to find an element in something that implies use of a query. "

  7. #7
    School Boy Error is offline Advanced Beginner
    Windows 7 32bit Access 2013 64bit
    Join Date
    Oct 2012
    Posts
    72
    I saw that thread but there was no solution. I can't find the ROWSOURCE query but found the RECORDSOURCE and that refers to the correct query...

  8. #8
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Stop the code on that line and before it executes, export the query manually from the nav pane to a pdf.

  9. #9
    School Boy Error is offline Advanced Beginner
    Windows 7 32bit Access 2013 64bit
    Join Date
    Oct 2012
    Posts
    72
    I've attached a copy of the database. It's the mainSummary report that is causing me the issue. The other one works
    Attached Files Attached Files

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It doesn't error for me, but with no data it also doesn't export anything.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    If you do post #8 you will get an error.

  12. #12
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Paul, he has On Error Resume Next. Same happened to me!

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Ah. Perhaps using the correct report name in the code would help...
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    School Boy Error is offline Advanced Beginner
    Windows 7 32bit Access 2013 64bit
    Join Date
    Oct 2012
    Posts
    72
    Quote Originally Posted by pbaldy View Post
    Ah. Perhaps using the correct report name in the code would help...
    Arggghhhh really? I'll check as soon as I get to work!! I do have an on error resume next but commented that out while testing - it's there in case people click cancel on print out export...

  15. #15
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sorry, yes. You have a non-existent report in the output code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 02-26-2016, 12:34 PM
  2. Replies: 2
    Last Post: 08-22-2015, 11:26 AM
  3. Replies: 2
    Last Post: 10-15-2014, 04:23 AM
  4. Replies: 13
    Last Post: 06-12-2012, 09:52 PM
  5. Error in Runtime Only
    By drunkinmunki in forum Programming
    Replies: 7
    Last Post: 12-16-2010, 03:43 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