Solved

MOVE FILE

Posted on 2016-10-31
2
63 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

627 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