Domanda

I recently inherited an Access DB and I have been asked to modify it a little. The file extension is not the typical MDB but is ADP.

In this DB there is a report and it is called, via VBA, like this:

DoCmd.OpenReport "rptExpirationReport", acViewPreview
DoCmd.Maximize

When the window opens after this is called all the user needs to do is click the print button. This prints the entire report to the default printer. The print dialog box doesn't come up, the data just goes straight to the printer.

What I have been asked to do is reduce the amount of paper this process uses so I am going to change this to print to a PDF.

The first issue is that I don't want to change the default printer on the user's computer to print to PDF. So I need to have a way to print this to an installed PDF printer.

The second issue is that I don't know how I'd go about changing this because the Access report window doesn't have many options that I can find. I don't see a way in the VBA code to change the printing button so the user can select their PDF printer.

The last issue is that the report contains a form that is filled out with a person's information and it does this for each person. So if I print this to a PDF, there could be 50 forms that I need to separate out into individual files. The forms are generated one per record and it's just one form that gets filled out, but the form could be 2 or 3 pages, so that isn't constant.

È stato utile?

Soluzione

A report can either be pointed to the default printer or a specific printer. To do this through the user interface open the report in design view and select Page Setup. Then on the Page tab Click Use Specific Printer then click the Printer Button to select your PDF virtual printer. Please see the following screenshot for an example:

http://screencast.com/t/lGnYMQm6EIj

To do this programmatically please see the following link:

http://www.access-programmers.co.uk/forums/showthread.php?t=225910

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top