Renaming file

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
 
K

Ken Snell [MVP]

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"
 
G

Guest

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top