Solved

Fake printer

Posted on 2013-01-21
2
535 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

831 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