Solved

File Overwrite in Access VB

Posted on 2010-11-20
1
277 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
[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
1 Comment
 
LVL 120

Accepted Solution

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
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…
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…

617 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