Solved

MS Access Macro with timestamp on filename

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
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…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

805 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