Newbie in over his depth!!! help please!!!

Watson

New member
Local time
Today, 04:20
Joined
Oct 14, 2005
Messages
2
Gettign a macro to export a file and save it

Q:
Is it possible to a macro in Access to export a Report to a given folder and name it so as not to overwrite any existing files?
would be great if it could write the file with the date and time :)

i have a macro which currently prints several reports from the database in one go. These reports are currently printed twice daily and we are required to file these to provide a traceable history. If i could get access save these it would save alot of filing space!!

any help greatly appreciated!!!!

cheers

Watson
 
Last edited:
Use date / time functions to build report name

strNow = Year(Now()) & Month(Now()) & Day(Now()) & Left(Time$, 2) & mid(time$,4,2)

strFilename = "c:\myfiles\myreport" & strNow & ".rpt"
 
This is best done in a module

Code:
Dim strFilename As String

strFilename = "Myname" & Format(Now(), "yyyymmddhhmmss") & ".txt"

DoCmd.TransferText acExportDelim, "", "queryname", strFilename, True, ""
 

Users who are viewing this thread

Back
Top Bottom