X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Select Printers, Configuration, Paper Sizes And Paper Bins For Reports, Access 2007    
post Feb 26 2012, 04:32 PM

UtterAccess Editor
Posts: 10,293
Joined: 8-November 07
From: South coast, England

This demo allows the user of each front end of a db to set their reports to a printer of their choosing;
Report types (configurations) are determined in the database design, however the user can then define which printer, page size, paper orientation etc for each report type.
The demonstration provides
1. A single report
2. 2 report configurations (further can be added by the developer)
3. commands to preview, print or e-mail (via MS outlook) reports. (nb Outlook should preferably be already open if e-mailing) either report configuration
4. e-mailed reports in rtf or pdf format
5. Preview Report or Preview mode
6. Margins adjustment
7. User defined paper sizes
8. Selection of printer paper bin
9. Monochrome printing
NB table 'tblPrntDflts' must be in the database Front End
the source tables for the report (tblCountres and tblRegions) are shown in the front end for the demonstration but would normally reside in the Back End database.
The printer selection is taken from the list of available printers on the local PC
To use this in your db simply:
1. Copy Table "tblPrntDflts", Module "ModSendToPrinter" and form "frmPrtSetup" to the Front End of your database.
2. In the form "frmPrtSetup" either hide the footer or delete the footer controls and associated code
3. Replace your existing open report commands
DoCmd.OpenReport "ReportName", ViewMode, , strCriteria, openArgs
PrintSelectPrinter "Reportname", ViewMode, ReportTypeID, strCriteria, OpenArgs
Where ReportTypeID is the ID of the report type to be used for the report taken from the table "tblPrntDflts"
Any comments or suggestions gratefully received.

Version 2 Corrected error in e-mail attachment type
Version 3 Added Paper Size selection based on printer device capabilities API (A2003 and A2007 available)
Version 4 Added Paper Bin selection based on printer device capabilities API, and monochrome printing option
Version 5 Corrects error (Thanks to Daniel Pineault for pointing this out) Default printer automatically replaces a non valid printer, or if no printer is selected.
Version 6 Added Print duplex options
Version 7 Added Print Quality selection

Deleted earlier attachments (880 downloads)
Attached File(s)
Attached File  PrinterSelect_Demo_V7.zip ( 146.7K )Number of downloads: 320
Go to the top of the page
post Dec 9 2012, 05:11 PM

Posts: 75
Joined: 13-May 03

Many thanks for your excellent Printer Select Demo.
I ran the programm, but could not find the table with the printer defaults, to be copied to the front end, as mentioned in your write-up.
reetings from continental Europe.
Go to the top of the page
post Dec 10 2012, 02:24 AM

UtterAccess Editor
Posts: 10,293
Joined: 8-November 07
From: South coast, England

Hi LuigiSoft
Pleased you liked the demo
In the demo the "tblPrntDflts" table is hidden, to see the table:
1. In A2007
Right-click the menu at the top of the Navigation Pane and then click Navigation Options,
Select the 'Show Hidden Objects' check box
Click 'OK'
2. in A2003
On the main database menu bar (IIRC) you can find 'Show Hidden Objects' under Tools -> Options
Go to the top of the page
post Aug 21 2013, 02:35 PM

Posts: 1
Joined: 18-July 13

The code needs to be slightly updated for x64 Access 2013 with VBA7, as the program errors indicating that the declarations need to be updated with the PtrSafe keyword:
imply adding "PtrSafe" after the two DECLARE statements fixes it.
Private Declare PtrSafe Function ....
Go to the top of the page
post Aug 21 2013, 06:48 PM

UtterAccess Editor
Posts: 9,934
Joined: 7-December 09
From: Staten Island, NY, USA

Thanks for the note. Likely any pointer data types (certain Long types in VBA6) will need to be updated to LongPtr as well, in order to ensure full 32 and 64bit compatibility. The Category:API in UA's Wiki has many VBA7 declarations for examples.
Go to the top of the page
post Sep 2 2013, 07:51 AM

Posts: 3,919
Joined: 19-October 10

Hi Jack,
I've ran into problems using the api functions to get the paper bin names, it returns various paper sizes mixed in the the paper bin info.
Checking your demo it has the same issues unfortunately, I made a quick and dirty fix but I don't know if it would be applicable to all printers. If I think of a proper solution I'll share it but wanted to flag it up to you incase you can track in down yourself.
Go to the top of the page
post Sep 5 2018, 01:37 AM

Posts: 1
Joined: 4-September 18

Hi, anybody still here.
Please help. I was very glad to found this solution today.
I have just tried and faced a problem when the program stepped into
the module PrintSelectPrinter(..) when it reached the line
"Reports(strSelRpt).Printer = prt "
inside the select case 0...
My Access then shown the message "Microsoft Office ...Stop Working."
and then close the database.

I'm using MS-Access 2007 SP2 on Windows10(64)

Can anybody help please?
Go to the top of the page

Custom Search
RSSSearch   Top   Lo-Fi    22nd October 2018 - 08:29 PM