473,503 Members | 2,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I set path and name of report printed to virtual printer?

26 New Member
Hi,

I've installed a virtual printer that allows me to save access reports as .pdf files. Within Access (using VBA) I'm using the DoCmd.OpenReport action to send the file to be printed. When I do this a pop up box appears asking me for the path and name of the file to be saved.

Since I'm trying to automate this process, how do I set these parameters programatically in VBA?

Below is an excerpt of the code I have so far.

Expand|Select|Wrap|Line Numbers
  1. Function CutReports()
  2. Dim rsContacts As New ADODB.Recordset
  3. Dim RPTPAN As Access.Report
  4. Dim strName As String
  5.  
  6. rsContacts.ActiveConnection = CurrentProject.Connection
  7. rsContacts.Open "QRY12MoReviewNewMIPNo"
  8.  
  9. Do While Not rsContacts.EOF
  10.  
  11. 'Send data for this active record to Report and save as PAN.pdf
  12. strName = rsContacts!EEFullName 
  13. DoCmd.OpenReport "RPTPAN", acViewNormal, , "[EEFullName] = '" & strName & "'"
  14. ‘Here is where I’m stuck.  I need to dictate where and under what name to save the file.
  15.  
  16. DoCmd.Close acReport, "RPTPAN", acSaveNo
  17.  
  18.  
  19. 'Move to the next person in the recordset
  20. rsContacts.MoveNext
  21.  
  22. Loop
  23.  
Apr 20 '09 #1
4 2216
DonRayner
489 Recognized Expert Contributor
You could try the SendKeys function. I don't use it myself but I played with it a bit and this is how I got it to work. I had to use the forms timer to delay the sendkey function to give the save dialog enough time to open.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "RPTPAN", acViewNormal, , "[EEFullName] = '" & strName & "'"
  2. Me.TimerInterval = 500
  3.  
  4. Private Sub Form_Timer()
  5. SendKeys "DocumentName.pdf" & "{enter}", True
  6. Me.TimerInterval = 0
  7. End Sub
  8.  
Apr 20 '09 #2
NeoPa
32,557 Recognized Expert Moderator MVP
Ingenious solution Don :)

The simple answer is that there is no programmatic access to it as such. As far as Access (therefore your code) is aware, it is sending a report to a printer. The PDF builder part of the driver you're sending it to is entirely non-standard.

Having said that, it is possible that the provider of the software has released a separate API that you could use to control it directly. This depends on who the provider is of course. It may be worth a look (Google, or contact them directly).

Good luck with your project.
Apr 21 '09 #3
raddrummer
26 New Member
Will do. Thanks to all for checking it out.
Apr 21 '09 #4
NeoPa
32,557 Recognized Expert Moderator MVP
No worries.

Good luck with your project :)
Apr 21 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5737
by: Mohan | last post by:
Hi All, I am using web browser control in a VB 6.0 client server application to print reports. I am writing the report into a HTML file and displays the report to the user using the code,...
1
2364
by: hawk | last post by:
I am creating a series of custom reports, whose parameters are specified through combo boxes in a form, which then generates a custom report based on a series of calculation queries. My problem is...
2
4570
by: Wolfgang | last post by:
Hi, I need to timestamp printed records with the printing date. According to the customer's requests the report must be opened in preview-mode and the user clicks on the printer button if he...
0
983
by: Chuck Van Den Corput | last post by:
I had posted the following question earlier under, what I believe now to be, a misleading subject line. Let me try again. I have an A97 report with numerous sub-reports that can be viewed in...
2
2759
by: Jelena B | last post by:
Bitmap that I put on my Crystal Report is printed in very bad resolution; it is completely rastered, and it is very hard to read letters on it. Printer settings are: Quality Settings: Draft...
6
4751
by: MLH | last post by:
I am unsure how to do this. I want this tray to be used for certain print jobs - jobs that will prompt me to load the bypass tray with sheet labels. How to force this? Dunno. Its the HP LaserJet...
1
3330
by: adolph | last post by:
I have a problem with pages being printed out of order. An example is a 15 page duplexed report. Title page fine back of title page blank. (As it should be) SEcond page front, bottom says Page 1...
1
6480
by: Ron | last post by:
Hi All, I'm using A2K and need to print a specific pre-printed form. I know that once I have that report on a particular computer screen I can select "Page Setup" and change the margins to get...
6
2588
by: prakashwadhwani | last post by:
While making Vouchers in a form, I have a POST button which validates & posts the transaction to the main Accounts File. I also have a PRINT button which provides the user with a preview of the...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.