Solved

File Overwrite in Access VB

Posted on 2010-11-20
1
276 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access Query - calculate End of the Month in Query 2 54
MS ACCESS VBA FORMATTING 9 63
Combo box with two columns question 7 40
Batch convert csv to xlsx 10 60
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

739 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