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.OpenRepor t 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. -
Function CutReports()
-
Dim rsContacts As New ADODB.Recordset
-
Dim RPTPAN As Access.Report
-
Dim strName As String
-
-
rsContacts.ActiveConnection = CurrentProject.Connection
-
rsContacts.Open "QRY12MoReviewNewMIPNo"
-
-
Do While Not rsContacts.EOF
-
-
'Send data for this active record to Report and save as PAN.pdf
-
strName = rsContacts!EEFullName
-
DoCmd.OpenReport "RPTPAN", acViewNormal, , "[EEFullName] = '" & strName & "'"
-
‘Here is where I’m stuck. I need to dictate where and under what name to save the file.
-
-
DoCmd.Close acReport, "RPTPAN", acSaveNo
-
-
-
'Move to the next person in the recordset
-
rsContacts.MoveNext
-
-
Loop
-
4 2219
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. -
DoCmd.OpenReport "RPTPAN", acViewNormal, , "[EEFullName] = '" & strName & "'"
-
Me.TimerInterval = 500
-
-
Private Sub Form_Timer()
-
SendKeys "DocumentName.pdf" & "{enter}", True
-
Me.TimerInterval = 0
-
End Sub
-
NeoPa 32,564
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.
Will do. Thanks to all for checking it out.
NeoPa 32,564
Recognized Expert Moderator MVP
No worries.
Good luck with your project :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
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, webbrowsercontrol.navigate2 "path of the html
file" method.
When the user clicks command button on the VB form to print the report
I am using the...
|
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
this...at the top of the report I've inserted several text boxes which
link to the combo boxes on the entry form, and are supposed to show
which...
|
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 really want to have a
hardcopy.
The customer selects the records with a special selection form, where
he can combine up to appr. 20 different...
|
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
preview mode without any problem. However, when users print this
report (in a network environment), the report doesn't make it from
Access to the...
|
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
Print Quality 300 x 300 dots per inch.
The problem is that the same bitmap, on the same printer and same
| |
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 4200.
|
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 of 15. Second
page back says Page 10 of 15. Third page front says Page 3 of 15.
Third page back says Page 4 of 15. Special not Page 10 of 15 is...
|
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 the different fields I'm printing where
I need them to print (fine tuning type of changes as all the controls are
basically printing where...
|
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 "to be printed" Voucher & then prints it onto paper.
When the user clicks PRINT ... my code validates the voucher & prints
it. Now I have to POST...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |