MS Access 2003 -print report to file? mdi/tif

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everybody,
I'm a pretty seasoned Access developer and have a problem now. I need to
reprint a certain report multiple times from code, each time for a diferent
customer, meaning the report changes for each printout.
These reports need to be printed to a file, not a printer. Each "printout"
will get a different file name.
How do I do this completely automatically via VBA?
I Googled this thouroughly. I've seen some talk about MODI, but I didn't see
how anyone uses this for outputting Access report to .mdi files. I see others
use third-party tools for generating PDFs, but my client won't accept
3rd-party.
I will immensely appreciate any and all help offered.
Thankfully, YisMan
 
Hi YisMan,

To create MDI files you can iterate through the Application.Printers
collection to find the one called "Microsoft Office Document Image Writer".
For example on my machine this:
Application.Printers(1)
returns the image writer. This assumes that it is installed of course ;-)

Once you have determined which item in the collection is the one you want
you can set the Application.Printer property, e.g.:
Set Application.Printer = Application.Printers(1)
and happily print away using that 'printer' to throw out files.

Hope that helps!
RealJC
 
Dear RealJC,

Thanks for taking an interest. It is true what you write that I can set the
printer using the Application's Printer object. The problem is, as I pointed
out in my post, that I must output each "print" to a different file. I have
found no way to set the output file name through the Application.Printer
object. Have I missed something?

I meanwhile researched and found that many people output to .snp files. This
won't work for me either, as my client needs to email these from time to time
to a broad range of customers, many without internet access and many with
different OSes. These recipients won't be able to open the .snp files.

I am interested in any leads. Thanks again for your quick reply and
willingness to help.
Thankfully, YisMan
 
Don't know if this will be your solution or not, but in my appl I have an
option to print reports to a word doc using Docmd.OutputTo (i.e. using the
OutputTo macro command). This gives a few different options for the type of
file you want the report to go to. I use the RTF format (you can also use
Excel, text, HTML or snapshot) to send it to a word doc, which can then be
printed. This allows you to specify the filename (with my appl the user
specifies the file they want to send the report to - I open up a standard
windows file open dialog for them to specify the file name), so you can
execute the command once for each report, specifying a different file name
for each one. The only problem with sending it to Word is it loses some of
the formatting detail (separator lines, etc). Snapshot may work for you, I'm
not sure exactly what that does. Hope this helps.
 
Thanks for your help, Jim. I'm afraid this option won't work out for me
either. The reason is because I need to output at once a few hundred files
automatically via code. The process must be entirely transparent to the user.
Going through your option for each file is overkill in my application.
Thanks anyway for trying to help. Meanwhile I'm using snapshot files for the
output, because I can easily create them with the OutputTo method. Even
though they are far from an ideal solution, not the least because of the
special viewer it needs among other inconveniences.
If anyone has some experience with such a situation, and a good solution,
I'll really appreciate if he can share it with me.
Thankfully, YisMan
 
Hello,

Thanks for this info. However, how would I do this with multiple reports?
I have around 10 of them that need to be saved as a pdf file to my local hard
drive.

Thanks!
MN
 
Back
Top