Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

File Overwrite in Access VB

Posted on 2010-11-20
1
Medium Priority
?
280 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

971 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