Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2005
    Posts
    55

    Exclamation Unanswered: Change filename of Report on output

    I would like to know how to assign a name based on a report filed to the report output.

    I am using the DoCmd.OpenReport method

    I would like to change the default filename (name of report) that is automatically assigned.

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    How are you currently saving the report to a file? I believe (without looking though) that there are options in the OutputTo command itself to save the report with whatever name you code in the OutputFile parameter for the command. You could create an inputbox to enter and assign a variable a name to use as a parameter of the command.

    (expression.OutputTo(ObjectType, ObjectName, OutputFormat, OutputFile, AutoStart, TemplateFile, Encoding)
    Last edited by pkstormy; 07-21-08 at 23:20.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Mar 2005
    Posts
    55
    PDF.

    I output to pdf, but i want to be able to have unique filenames for archiving. Not sure how to assign the name.

  4. #4
    Join Date
    May 2008
    Location
    Raleigh, NC
    Posts
    151
    This should be the correct format;

    DoCmd.OutputTo acOutputReport, "rptTest", , "rptTest2"
    --If its free, take it for what its worth!

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    I'm still not quite sure what the question is :/

    To ensure uniqueness, you should use a primary key from the table in part of the file name specification.

    If you are using DoCmd.OpenReport to create the PDF, my guess is that you are creating the PDF via a PDF print driver. I would have no idea how you could automate a unique output name using that method.

    If I am on the right track here, you will need to create your PDF files via a PDF writing API or something, so that no-one has to actually print a report to create a PDF.

    Enough guessing from me
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •