Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178

    Unanswered: Print Access Report to a .pdf File

    I'd like to be able to open a report in VBA and have it go IN ONE STEP to a unique file name, as fed to it somewhere in the code.

    I run a routine that prints a report over and over based on customer codes provided by a table. I don't want to print the reports to paper, but to .pdf. Eventually, these reports will be emailed in batches to field salespeople to use in their sales calls.

    However, I have a problem. Right now I use a .pdf (not Adobe) driver that prints to my desktop (I don't want to mess with my default, in case I forget to reset it at the end of the session). In a separate step, I then rename and move the file to its proper location. However, this all takes time, and there are times when I get a message asking if I want to overwrite the file. The dialog box always points to the desktop file. Obviously, the two-step of the previous report(s) took longer than the program did to generate the next report, and I can't be sure that I'm not missing some customers' reports when I click 'yes' to the overwrite question.

    I think that if I did it in one step, I wouldn't have the potential problem. In order to do that, I need to provide Access with two data: 1-the target folder, and 2-the customer code, which is the actual file name (drive\folder\customercode.pdf). How can I do this all from within VBA?

    My current code is:
    Code:
                DoCmd.OpenReport "rptUnboughtItems"
                Name "C:\Documents and Settings\SL\Desktop\rptUnboughtItems.pdf" As "Q:\Reports\UnboughtItems\" & !custno & ".pdf"
    Thanks for listening, and for your assistance.

    Sam

  2. #2
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    Check out this site: ReportToPDF

    Otherwise, I use Win2PDF (does cost around $35) which works nicely with VBA. They have good examples in the help file.

    C

  3. #3
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    C,

    I downloaded the ZIPped files, and will research them ASAP. As far as spending money, that's a no-no around here.

    Thanks so much,

    Sam

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I use ReportToPDF which I believe is specific to Adobe. I modified it slightly for my own uses, but for the most part it is the same and works great.

Posting Permissions

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