473,899 Members | 3,071 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export Report as PDF & Save with Today's Date

7 New Member
I am trying to create a macro to save the PDF each day. The following is what I have so far. The Output File code is the one that is probably causing me problems.


Expand|Select|Wrap|Line Numbers
  1. Access 2010
  2. ExportWithFormatting
  3. Object Type:Report
  4. Object Name:R_Daily_Log
  5. OutputFile: "R:\PRIVATE\OEA\Daily_Media_Logs\"&"Media_Log-"& (Format(Date(),"yymmdd")&".pdf"
Mar 28 '13 #1
11 13564
Seth Schrock
2,965 Recognized Expert Specialist
Do you get an error message with this or does it just not produce the results that you want? If you get an error message, please provide the exact wording.

While this shouldn't matter, you have split up your OutputFile string more than you need to. You should be able to use
Expand|Select|Wrap|Line Numbers
  1. "R:\PRIVATE\OEA\Daily_Media_Logs\Media_Log-" & Format(Date(), "yymmdd") & ".pdf"
In writing that out, I just noticed that you have one too many (. Try removing the one before the Format, or just copy what I have.
Mar 28 '13 #2
7 New Member
First - Thanks for your help. I tried your code with and without the extra "(" and it paste the following file in the right folder "Media_Log-". However, it overwrites it every time I run it. The code added a #1 when I first pasted it at the beginning, and it did not work until I deleted it.

Error message = MS Access can't save the output data to the file that you've selected.
*File may be open - not because it is going to be new each day
*Using a template - not
*Disk space - should not be an issue
*Make sure the file exists on the path specified. ??New??
*Check to make sure you have permission to write to the folder. This should not be a problem.
Mar 28 '13 #3
Seth Schrock
2,965 Recognized Expert Specialist
I have never done this via Macro, so this is mostly guessing. Please verify that the folder R:\PRIVATE\OEA\ Daily_Media_Log s does exist. If if does, then right just right clicking in the folder, hover over New, and select Text document. As long as it allows you to create the file, then you have permissions to create new files.

If none of this works, I would have to recommend using VBA as most of us at Bytes don't have much experience with Macros and use VBA almost exclusively. The error messages also tend to be a little more helpful.
Mar 28 '13 #4
5,501 Recognized Expert Moderator Expert
Macro language will have very little support in this forum as most of us use VBA.

It will be helpfull to see your entire macro... HOPFULLY, you are using Access 2010 (please)
If so,
Please open the macro in design mode.
Click somewhere within the code... do Not Double Click!
Press <ctr><a> to select everything within the macro.
Press <ctrl><c> to copy
Open this thread.
In the replay box, Click on the [CODE/] button in the tool bar.
Place the cursor between the [code] [/code] tags
press <ctrl><v>

You should get look something like>>>

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-16" standalone="no"?>
  2. <UserInterfaceMacros xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"><UserInterfaceMacro MinimumClientDesignVersion="14.0.0000.0000"><Statements><ConditionalBlock><If><Condition>[currentproject].[istrusted]</Condition><Statements><Action Name="Beep"/> (...omitted the remaining)

- Now we can see your macro. :)
Mar 28 '13 #5
7 New Member
Expand|Select|Wrap|Line Numbers
  1. Name="ExportWithFormatting"><Argument Name="ObjectType">Report</Argument><Argument Name="ObjectName">R_Daily_log</Argument><Argument Name="OutputFormat">PDFFormat(*.pdf)</Argument><Argument Name="OutputFile">"R:\PRIVATE\OEA\Daily_Media_Logs\Media_Log- &amp; (Format(Date(), "yyyymmdd")) &amp;.pdf</Argument><Argument Name="AutoStart">Yes</Argument></Action></Statements></UserInterfaceMacro></UserInterfaceMacros>
Mar 28 '13 #6
7 New Member
I have been able to get a file saved in the file, but it will not add the date. It also replaces itself each time I run it. I need it to place the date and retain it.

Mar 28 '13 #7
Seth Schrock
2,965 Recognized Expert Specialist
You didn't put it in Code tags as requested. It looks like you are missing an ending double quote in the OutputFile line. Make sure that you have quotes around everything correctly.

Could you provide the name that it is saving the file as so that we can see what it is producing?
Mar 28 '13 #8
7 New Member
File name: Media_Log-&Format(Date(), mmddyyyy)&

It will save a variety of names, but it does not like quotes before Format or around the .pdf.
Mar 28 '13 #9
7 New Member
I added the additional quotes at the end, and it gave me the following file name:Media_Log- & (Format(Date(),

It also took away the PDF file format.

@Seth Schrock
Mar 28 '13 #10

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

Similar topics

by: Gerry Viator | last post by:
Hi all, I have a textbox were a time is typed in like: upto 4 numbers 1900 300 1000 1425 I would like as they type the text to show todays date plus the time they
by: Chuck | last post by:
Using a macro to output a query to an Excel file. Is there a way to automatically add todays date in the file spec? As: C:\Access Data\ & todays date.xls Chuck ....
by: Vayse | last post by:
In VB6, I would have used Date() That no longer works. How do I find todays date in VB.net?
by: Mariana | last post by:
Hello, I am exporting reports in pdf format from .net 2005 . The export is working fine; however the user values of stored procedure parameters does not show in the report. What do I need to do in order to see the parameters value in the report? The report has a report parameter "reportTitle" and i see the value in the report. It has also another 2 stored procedure parameters @BeginDate and @EndDate. The values are entered be the user;...
by: Drum2001 | last post by:
Hello, I am having isues with the following: I have two forms, a MAIN FORM with a SUB FORM: Within the MAIN FORM, I have an unbound textbox (Date Format) and a command button. Onload, the textbox defualts to Date(). The SUB FORM has a bound textbox (Date Format). I am trying to create the code for the command button to compare the
by: Luqman | last post by:
Hi, Any Idea how to Display Todays Date in DetailView Template Field while Inserting ? For example: When I click on New Button of DetailView Control, I need to display Today's Date in a Template Field text box. I tried following in DetailView1_ModeChanged Event but could not succeed. Protected Sub DetailsView1_ModeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.ModeChanged
by: jonosborne | last post by:
Hi guys, im a bit of a novice being thrown in at the deep end ! Using MS Access 97 i have a table with data that is updated once a day from an Excel spreadsheet. I need a way of identifying when data was added to this table so i have added an extra field (titled 'Date') and need to create a query that updates the empty field with todays date, so that every day this query will run and replaces any empty data in the field with todays date. ...
by: raaman rai | last post by:
Hello everybody, i m working on PHP and MS Access DB. actually i have the date problem. Pls view my code below: $completedate=$query->fields->Value; $compdate=date('d-m-Y',$completedate); $currentdate=strtotime("now"); $currdate=date('d-m-Y',$currentdate); if($compdate=<$currdate) { print "<td width='8%' style='BORDER-RIGHT: #009900 1px solid; BORDER-TOP: #009900 1px solid; BORDER-LEFT: #009900 1px solid; BORDER-BOTTOM: #009900 1px...
by: hathewj | last post by:
My export line looks like this: EXPORT DATA TO C:\IMPORT\ASSETS.CSV (DATAFORMAT = CSV This works OK, but this file is eventually sent automatically via FTP to another location and the file has to be in this format: ASSETS-YYYY-MM-DD.CSV where the yyyy,mm,and dd are todays date. Rather than rename each after the proc has run, is there a way to allow DB2 to add that date? Thanks
by: phpmel | last post by:
Hi guys, I have an asp calendar control, text box, calendar icon, eraser icon all within an update panel. The calendar works fine, postbacks are handled without the flickering of the screen etc. my only problem is that i can not select today's date to display in the text box because by default, today's date is the selected date. <asp:UpdatePanel ID="UpdatePanel_start" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional"> ...
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
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 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.