Solved

File Overwrite in Access VB

Posted on 2010-11-20
1
273 Views
Last Modified: 2012-05-10
I am renaming a string to move it from one directory to another, but i would like to also overwrite a file that may already exist - how can i check if it exists before i do the rename and overwrite if necessary without warnings?

Name "c:\Users\Alan\Documents\" & strFileName As "f:\Quality Systems\Change Control\Associated Documents\" & strFileName
0
Comment
Question by:SweetingA
1 Comment
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 34180495

'delete the destination file if exists with this code

if dir("f:\Quality Systems\Change Control\Associated Documents\" & strFileName)<>"" then
   kill "f:\Quality Systems\Change Control\Associated Documents\" & strFileName
end if

Name "c:\Users\Alan\Documents\" & strFileName As "f:\Quality Systems\Change Control\Associated Documents\" & strFileName
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

919 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

19 Experts available now in Live!

Get 1:1 Help Now