PC Review


Reply
Thread Tools Rate Thread

How do I assign a name to a PDF report via VBA

 
 
ND Pard
Guest
Posts: n/a
 
      8th Feb 2010
Thanks to the internet site:
http://msdn.microsoft.com/en-us/library/ee336132.aspx

I have the following subprocedure:

Private Sub Print_to_PDF_Click()
On Error Resume Next
Dim reportName As String

reportName = "HCBS CMgr Smmry Report"

DoCmd.OpenReport reportName, _
View:=acPreview, WindowMode:=acHidden
Set Reports(reportName).Printer = _
Application.Printers("CutePDF Printer")
DoCmd.OpenReport reportName, _
View:=acViewNormal
End Sub

This appears to be a good start; however, it stops and
waits for me to enter the name of the PDF report.

I want the name to come from a variable,
say: strMyPDFName

Then I'll send it to through a Loop to print approx
50 different PDFs, each with a unique name.

How can I modify the above code to pass the
PDF name to the PDF report?

Your help is needed and will be GREATLY appreciated.

Thanks in advance.
 
Reply With Quote
 
 
 
 
Daniel Pineault
Guest
Posts: n/a
 
      9th Feb 2010
According to the following post: "That pdf creator does not supprot
automation..and thus you can't set the file name as far as I know..."

http://bytes.com/topic/access/answer...using-cute-pdf

You need to switch to an alternate pdf software, pdf creator or acrobat,...
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"ND Pard" wrote:

> Thanks to the internet site:
> http://msdn.microsoft.com/en-us/library/ee336132.aspx
>
> I have the following subprocedure:
>
> Private Sub Print_to_PDF_Click()
> On Error Resume Next
> Dim reportName As String
>
> reportName = "HCBS CMgr Smmry Report"
>
> DoCmd.OpenReport reportName, _
> View:=acPreview, WindowMode:=acHidden
> Set Reports(reportName).Printer = _
> Application.Printers("CutePDF Printer")
> DoCmd.OpenReport reportName, _
> View:=acViewNormal
> End Sub
>
> This appears to be a good start; however, it stops and
> waits for me to enter the name of the PDF report.
>
> I want the name to come from a variable,
> say: strMyPDFName
>
> Then I'll send it to through a Loop to print approx
> 50 different PDFs, each with a unique name.
>
> How can I modify the above code to pass the
> PDF name to the PDF report?
>
> Your help is needed and will be GREATLY appreciated.
>
> Thanks in advance.

 
Reply With Quote
 
Mark Andrews
Guest
Posts: n/a
 
      9th Feb 2010
Most pdf printer drivers require a registry setting to suppress the filename
prompt. I have mainly worked with win2pdf which is a great printer driver!

Most access 2003 and earlier users just use Lebans pdf routines to create
pdf files. Do a search I'm sure you will find them.

In access 2007 it has builtin pdf creation.

HTH,
Mark

"ND Pard" <(E-Mail Removed)> wrote in message
news:8D5B57FD-7024-4F4A-A001-(E-Mail Removed)...
> Thanks to the internet site:
> http://msdn.microsoft.com/en-us/library/ee336132.aspx
>
> I have the following subprocedure:
>
> Private Sub Print_to_PDF_Click()
> On Error Resume Next
> Dim reportName As String
>
> reportName = "HCBS CMgr Smmry Report"
>
> DoCmd.OpenReport reportName, _
> View:=acPreview, WindowMode:=acHidden
> Set Reports(reportName).Printer = _
> Application.Printers("CutePDF Printer")
> DoCmd.OpenReport reportName, _
> View:=acViewNormal
> End Sub
>
> This appears to be a good start; however, it stops and
> waits for me to enter the name of the PDF report.
>
> I want the name to come from a variable,
> say: strMyPDFName
>
> Then I'll send it to through a Loop to print approx
> 50 different PDFs, each with a unique name.
>
> How can I modify the above code to pass the
> PDF name to the PDF report?
>
> Your help is needed and will be GREATLY appreciated.
>
> Thanks in advance.


 
Reply With Quote
 
ND Pard
Guest
Posts: n/a
 
      10th Feb 2010
Wheeewwww ....

Success tastes sweet!

I was able to send multiple documents to PDF files via VBA, but only after
much internet searching.

I created variables:

Dim MyPath as String
Dim MyFilter as String
Dim MyFileName as String

MyPath = Me.txt_PDF_Folder.Value

MyFileName = Me.cbx_Counties.Value

MyFilter = "[County_Name] = '" & Me.cbx_Counties.Value & "'"

DoCmd.OpenReport "MyReportName", _
acViewPreview, , MyFilter

DoCmd.OutputTo acOutputReport, "", acFormatPDF, _
MyPath & MyFileName, False

DoCmd.Close acReport, "MyReportName"


That's all it took ... and it works like a CHARM!!!!

Don't cha just hate it when they tell ya it can't be done
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to assign value to controls on a Report Ayo Microsoft Access Reports 1 14th Dec 2007 12:21 AM
How to assign values to the report ? Paul via AccessMonster.com Microsoft Access Reports 1 22nd May 2005 10:44 AM
Why can't I assign a value to a textbox on a report? Dave Microsoft Access Reports 3 9th May 2005 02:15 PM
How to assign value to a report control? =?Utf-8?B?UGV0ZXI=?= Microsoft Access 2 29th Jun 2004 11:17 AM
crystal report viewer cant assign report source =?Utf-8?B?SkM=?= Microsoft VB .NET 1 12th May 2004 06:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:43 AM.