locked
ExportWithFormatting/EmailDatabaseObject: "Cannot find the object '| 1'" RRS feed

  • Question

  • Hi everyone,

    I have a client report in Access but can't get the ExportWithFormatting or EmailDatabaseObject macro functions to work. I get error 3021, "Cannot find the object '| 1'. Make sure the object exists and that you spell its name correctly". What is "| 1"? I have no such thing in my code. The invoice loads correctly with no errors, and print preview as well as printing works fine.

    Code:
    ExportWithFormatting
    ObjectType: Report
    Object Name:Test

    Any thoughts?

    Thanks in advance!



    EDIT: I just tested with a blank new report and the error is still coming up. Created a new report in a new database, no error...
    Sunday, July 24, 2011 4:26 AM

Answers

  • Thank you Joel but I just figured it out: The ObjectName must be = [Report].[Name], otherwise it will not work!
    • Marked as answer by sixstorm1 Sunday, July 24, 2011 3:31 PM
    Sunday, July 24, 2011 3:31 PM

All replies

  • I found this reference to the problem

    http://www.utteraccess.com/forum/Current-Record-Errnumbe-t1939011.html

     

    The "|" is a PIPE that  is taking the output of a libary function as outputting to arguement 1 which is normally in wiondows should be @1.  I if the problems isn't as specified in the webpage "No current record specified", then you are missing an arguement in you function call.

     

    Here is the webpage for ther function

    http://msdn.microsoft.com/en-us/library/ff192065.aspx

     

    Look at the example on the webpage

    DoCmd.OutputTo acOutputTable, "Employees", _
        acFormatRTF, "Employee.rtf", True

     

    I always use the following instead of the way microsoft shows the function

    DoCmd.OutputTo ObjectType:=acOutputTable, ObjectName:="Employees", _
        OutputFormat:=acFormatRTF, OutputFile:="Employee.rtf", AutoStart:=True

    Using the above formating allow you to skip optional parmaters and to list the parameters in any order you choose.

     


    jdweng
    Sunday, July 24, 2011 10:55 AM
  • Thank you Joel but I just figured it out: The ObjectName must be = [Report].[Name], otherwise it will not work!
    • Marked as answer by sixstorm1 Sunday, July 24, 2011 3:31 PM
    Sunday, July 24, 2011 3:31 PM