Solved

MS Access Macro with timestamp on filename

Posted on 2013-05-30
2
906 Views
Last Modified: 2013-06-21
I have a macro on MS Access 2007 that outputs to a file name....I receive an error when I try to add the timestamp to the file name.
 MS Access cant save the output data to the file you selected


Outputto    "P:\MAK Setup and documentation\MAK Reports\UDA_MAK\prn_pain\hlw_" & Format(Now(), "yyyymmddHHnnss") & ".xls"
0
Comment
Question by:hwassinger
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39207761
you can not use a variable inside the macro command..

use a vba function and call the function in your macro with

RunCode



Function Name  YourFunctionName()



create a  function in a Regular module

Function YourFunctionName()
' your export code here

End function
0
 

Author Comment

by:hwassinger
ID: 39207765
That would require a new vba code for each and every report that has a different name then?

Ive done this before I believe
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question