Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MS Access Macro with timestamp on filename

Posted on 2013-05-30
2
Medium Priority
?
1,032 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

704 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