Renaming file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi guys
I would like to rename text file on server after importing it. Maybe to
something like imported_filename.txt.
Currently I can import just fine but I'm stumped when it comes to renaming
file from access. Here is the code:

Private Sub Import_Click()
On Error GoTo Err_Import_Click
DoCmd.SetWarnings (WarningsOff)
DoCmd.TransferText acImportDelim, "102A-B Import Specification",
"Tbl_102B-A", "\\access\ftpdir\amko\102A-B.txt"
DoCmd.OpenQuery "Tbl_102B-A Query1", acViewNormal, acEdit
DoCmd.OpenQuery "Tbl_102B-A Query2", acViewNormal, acEdit
DoCmd.OpenQuery "Tbl_102B-A Query3", acViewNormal, acEdit
MsgBox "Import of 102A-B.txt file is finished."
DoCmd.SetWarnings (WarningsOn)

Exit_Import_Click:
Exit Sub

Err_Import_Click:
MsgBox Err.Description
Resume Exit_Import_Click
End Sub
 
Check out the Name statement in VBA Help file. It will let you do what you
seek to do.

Name "PathAndFileName_Old" As "PathAndFileName_New"
 
Thank you that worked perfect.

Ken Snell said:
Check out the Name statement in VBA Help file. It will let you do what you
seek to do.

Name "PathAndFileName_Old" As "PathAndFileName_New"
 
Back
Top