Print reports using vba, prtmip and prtdev

J

Jørn Nystad

Hi

Bare with me...
And especially my english...

I'm using access 2000 cause the customer demands it. and its going to run on
XP pro SP2.
Manipulating reports using prtmip and prtdev have alway been a bit tricky i
think.
:-(

in this case i need to print:
-Access report1
---On network printer1
---From tray1
---using duplex mode (i know the printer has this capability)
---with zero lenght margins (controling margins works fine through
prtmip :) )

-Access report2
---On network printer1
---From tray2
---No duplex mode
---with zero lenght margins

-Word document1
---On network printer1
---From tray3
---No duplex mode
---here i will set margins lenght

The print out prosess has a prospects/offer/sale order meaning they have to
be printet sequencially:
-Customer1
---Report1
---Report2
---Document1
Customer2
---Report1
---Report2
---Document1
and so on...

Prtmip and PrtDev provides fair control over the margins and duplex
settings, but i'm having a hard time saving print settings for each report
and the document between each printout.

Can anyone give me a small tour of printing from access vba? Whats important
to keep in mind? How's the setting for each report saved?
I realise i have to open the word document from access vba and maybe run a
vba macro in the word document to set margins and stuff. Is this right?

Some sample code would have been great.

In my scenario i want to have this logical flow i the vba code:
-check print settings (correct printer etc), Should i store this in a
table?
-if not ok --> open a dialogbox where the user can select printer.
settings for each report and document is static (is it possible to use
access print dialog box (ctrl+p)? i would like to avoid
CommonControl)
-set prtmip and prtdev on reports and the word dokument
-Print!

Any hint, tip, code samples, and lame jokes are welcome.



Mvh
Jørn Nystad
Oslo, Norway
 
S

SA

Jam:

1. To save the settings for prtmip and prtdevmode, you have to set them into
the report's properties and then save the report.

They will however, be "lost" if the user previews the report and then
selects a new printer using the standard Access print dialog.

2. You set the Word document properties using vba run in Access using
Automation. You do not run a macro in the word document itself. You can
address the Word document's settings using Access vba.

3. Yes, you can open the Windows Print Dialog from code (not using the
common control) and retrieve the devmode settings etc. and set them into a
table if you'd like, then reload them at run time.

4. Keep in mind this all works with MDB and ADP databases, but not with MDE
and ADE databases because you have to work with a report's design mode,
which you can't do in an mde or ade database.

The same code to do all this is very involved and takes a bit to work out
properly. The prtMip code is on our web site in the Code and Design tips
area under reports. If you want all the code for print dialogs, and other
settings, then take a look at our On the Fly Printing module which is in the
developer tools area. It has all the code you need to accomplish this;
however you'd need to break it down and pick out the areas you needed and
modify the code for your purposes.
 
J

Jørn Nystad

Hi Steve

Thanx for your reply.
This kind of tips and trick is exactly what i was looking for.

Regards
Jørn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top