Solved

Fake printer

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

632 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