Solved

MOVE FILE

Posted on 2016-10-31
2
52 Views
Last Modified: 2016-11-01
I would like to move a file from one location to another,overwrite the file if it's exists in the new location and inform the user if the transfer was successful.
Thanks
0
Comment
Question by:Svgmassive
2 Comments
 
LVL 88

Expert Comment

by:rindi
ID: 41867425
What OS? and what does this have to do with m$ Access?
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 41867487
try ths codes


Sub MoveFile()
Dim sFile As String, sPath As String, sDest As String
sPath = "C:\Users\xxx\OldFolder\"
sFile = "myExcel.xlsx"
sDest = "C:\Users\xxx\NewFolder\"
If Dir(sDest & sFile) <> "" Then
    Kill sDest & sFile
End If
   
Name sPath & sFile As sDest & sFile

If Dir(sDest & sFile) <> "" Then
    MsgBox "File moved"
End If

End Sub
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question