I have 12 daily csv reports that have a autonumber added to a standard naming
convention.
Is there anyway of renaming these files from a database so that my normal
import spec works without having to manually amend the file names.
STOLEN CODE... this belongs to Doug Steele...
Untested air-code. Note that I haven't bothered putting in error
handling if
the .txt file already exists in the folder.
Dim strFile As String
Dim strNewName As String
Dim strPath As String
strPath = "C:\Documents and Settings\SDF\"
strFile = Dir$(strPath & "*.sdf")
Do While Len(strFile) > 0
'-- CREATE THE NEW FILE NAME FROM THE OLD ONE...
strNewName = Left(strFile, Len(strFile) - 4) & ".txt"
'---THIS LINE RENAMES THE OLD FILE...
Name strPath & strFile As strPath & strNewName
'---IMPORT THE FILE
DoCmd.TransferText acImportFixed, "importspec", "SDF", _
strPath & strNewName
strFile = Dir$()
Loop