Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Fake printer

Posted on 2013-01-21
2
Medium Priority
?
562 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
Barry Cunney earned 2000 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…
Suggested Courses

670 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