Solved

MOVE FILE

Posted on 2016-10-31
2
34 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 87

Expert Comment

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

Accepted Solution

by:
Rey Obrero 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
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 retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now