Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add date to report name 1

Status
Not open for further replies.

Wrathchild

Technical User
Aug 24, 2001
303
US
How can I add the current date to my report name that gets automatically created in Acrobat?
here's what I have:

strReportName = "Report Name"
strFileName = strPath & "Report Name" & Now() & ".pdf"
Call PrintToAdobe(strFileName, strReportName)

this doesn't work...I just want to add the date at the end of the report name
 
Can't say I know your code but I suspect "strReportName" is the variable for your report name and not "strFileName"...
Try the following...

strReportName = "Report Name" & Now()
strFileName = strPath & strReportName & ".pdf"
Call PrintToAdobe(strFileName, strReportName)


You may need to format the results of now() or use the code below to get a good filename...

strReportName = "Report Name" & Now()
strFileName = strPath & "Report Name" & ".pdf"
Call PrintToAdobe(strFileName, strReportName)
 
thanks, but the Report Name is correct, it's calling that report to be created in Acrobat with the name strFileName. strPath is where the report is being saved to.
 
try

strFileName = strPath & "Report Name" & format(date(),"yyyymmdd") & ".pdf"


Dave
 
Can someone please tell me what the PrintToAdobe function is? I've never heard of it, but think it might be mighty handy.

Uncle Jack
 
thanks Dave (neufarth) that worked like a charm! Think I was making it more complicated than it is. In response to those asking what PrintToAdobe is, it's a function (actually a collection of functions) to print reports directly to Adobe Acrobat, sets the default printer to Acrobat, sets it back to your default printer when done and names the reports automatically and spits them out to the location specified. Works nicely. If you're interested in the code I got it from the book:

Microsoft Access 95 How-To
(c) 1998 Ken Getz and Paul Litwin

but I'm sure it's in other books too. I'd post the code, but it's pretty long and complicated and would probably bring up a ton of questions. If I find it on the web somewhere I'll post the link.

 
On the PrintToAdobe function you can also design a report and set the default printer value for that report to the PDF Writer. When you open the report with acNormal it automatically creates the PDF file. To me this is much easier than API calls to change the default printer.

Uncle Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top