Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the current date in an exported filename 1

Status
Not open for further replies.

TheMus

Technical User
Aug 23, 2000
28
US
How can I get the current date, formatted to "mmdd", to show in an exported filename?

Thanks
 
Hi there -- have a look at the [tt]format()[/tt] function, that will return a string formatted in the way you need.
 
I've tried this in the transfertext action but it exports the string, "format(date(),mmdd)", in the filename. I'm trying to get the current date populated in the middle of a filename. Example; pps932rpm & format(date(),mmdd) & a.upl output as pps932rpm0823a.upl?

Rus
 
Mus,

you need some quotation marks.

"pps932rpm" & format(date(),"mmdd") & "a.upl"

as your statement.


MichaelRed
There is never time to do it right but there is always time to do it over
 
I tried putting the quotes around the name also. It doesn't like the quotes. I'm using the DoCmd.TransferText action, could this be the wrong action?


 
TheMus,

If you want the community to look at the additional details (e.g. how you are setting up the TransferText command, we will need to see the entire 'command' as you are executing it. Also, if there are parameters in the command whic are developed prior to the command, we need to know what the value(s) of tose parameters are at the execution point of the command.


MichaelRed
There is never time to do it right but there is always time to so it over
 
You must define a string to be the filename BEFORE you use TransferText. i.e.
dim str as string
str = "pps932rpm" & format(date(),"mmdd") & "a.upl"
docmd.transfertext str (whatever the syntax is)
Chris
 
Chris, you are the man. Thanks for the input, it worked.

Rus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top