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!

TransferText action - filename specifications

Status
Not open for further replies.

elvanace1

MIS
Sep 26, 2005
32
US
I have a macro that uses a query result and the TransferText action to write a txt file to a server. I would like to encorporate the date & time stamp into the filename. Is that possible? If yes, how?
 
Is that possible? If yes, how?
I don't know with macro, but with VBA (the Format and Now functions).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I use this function to generate a filename:
Code:
Public Function MakeFileName()
  ' Description.......: Makes a file name from the date
  ' Accepts...........: Nothing
  ' Returns...........: A file name like 20020228.mdb
  ' Major change list.:

  Dim strDay As String    ' Day number as a two-digit string
  Dim strMonth As String  ' Month as a two-digit string
  Dim strYear As String   ' Year as a four-digit string

  ' Generate a ymd date string
  strYear = CStr(Year(Date))
  strMonth = CStr(Month(Date))
  If Len(strMonth) = 1 Then
    strMonth = "0" & strMonth
  End If

  strDay = CStr(Day(Date))
  If Len(strDay) = 1 Then
    strDay = "0" & strDay
  End If

  MakeFileName = strYear & strMonth & strDay

End Function

Geoff Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top