Solved

MS Access Macro with timestamp on filename

Posted on 2013-05-30
2
867 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 119

Accepted Solution

by:
Rey Obrero 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now