Solved

Fake printer

Posted on 2013-01-21
2
514 Views
Last Modified: 2013-01-22
Hi Experts,

I an issue that I hope someone can help me with. I have a MS Access database that uses Stephen Lebans ConvertReportToPDF. That works great but there is an issue. This database is used by many users that have different default printers installed. The reason why this is an issue is because ConvertReportToPDF uses the default printers settings when creating a PDF file. So if I create a PDF file i may look fine but when another person with another default printer installed are creating the same report, it may not fit 1 page and then two pages are created.

So i was thinking if it could be possible for my Access databse to add a "fake" default printer that it uses on all computer when creating PDF files?

I know this means that I also need some code to registrer the users default printer for when they are prtinting on paper, so I can switch between the real printer and the fake one.

Can some one help me with this issue?
0
Comment
Question by:DCRAPACCESS
2 Comments
 
LVL 17

Accepted Solution

by:
Barry Cunney earned 500 total points
ID: 38804531
Option Compare Database
Option Explicit

Public Declare Function SetDefaultPrinter Lib "winspool.drv" _
Alias "SetDefaultPrinterA" (ByVal pszPrinter As String) As Long

Public myPrinter As String

Private Sub Form_Load()
myPrinter = Application.Printer.DeviceName 'grab default printer so we can reset it on exit
End Sub

Sub PrintPDF_Click
Dim prtFake As Printer
Set Application.Printer = Application.Printers("\\ServerName\PrinterName\Fake")
Set prtFake = Application.Printer
SetDefaultPrinter prtFake 'set to Fake

' PrintPDF prtFake
 
End Sub

Private Sub Form_Unload(Cancel As Integer)
SetDefaultPrinter myPrinter 'reset to default
End Sub
0
 

Author Closing Comment

by:DCRAPACCESS
ID: 38804967
This was perfect!!!! You are the best!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now