UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Docmd, Access 2016    
 
   
mike60smart
post Jun 1 2020, 06:27 AM
Post#1


UtterAccess VIP
Posts: 14,027
Joined: 6-June 05
From: Dunbar,Scotland


Hi Everyone

I am trying to add a Date to a PDF file when using DoCmd.OutputTo.

I get the following error when trying to run it:-
Attached File  error.JPG ( 14.12K )Number of downloads: 0


Any help appreciated.

CODE
110   DoCmd.OutputTo acOutputReport, strReportname, acFormatPDF, "C:\PDF Reports\" & Format(Date, "mm/dd/yyyy") & _
               strReportname & ".pdf", False


Can anyone spot where I am going wrong?


--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
Doug Steele
post Jun 1 2020, 06:59 AM
Post#2


UtterAccess VIP
Posts: 22,305
Joined: 8-January 07
From: St. Catharines, ON (Canada)


You can't include the / symbols in your date format: they're not valid in file names.

--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
Personal webpage
Microsoft profile
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 
mike60smart
post Jun 1 2020, 07:31 AM
Post#3


UtterAccess VIP
Posts: 14,027
Joined: 6-June 05
From: Dunbar,Scotland


Hi Doug

Many thanks, just knew it had to be easy

cheers.gif

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
Doug Steele
post Jun 1 2020, 08:36 AM
Post#4


UtterAccess VIP
Posts: 22,305
Joined: 8-January 07
From: St. Catharines, ON (Canada)


Incidentally, if you want to include dashes or underscores in your dates to make them easier to read in the file names, you can use Format(Date, "mm\-dd\-yyyy") or Format(Date, "mm\_dd\_yyyy") respectively.

--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
Personal webpage
Microsoft profile
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    9th July 2020 - 07:10 AM