?
Solved

Access 2003 delete ntfs file from access macro

Posted on 2013-12-18
5
Medium Priority
?
647 Views
Last Modified: 2013-12-23
I need to delete a network file from a network folder from an ACCESS 2003 macro or module
0
Comment
Question by:eyes59
[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
5 Comments
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 39729047
From within VBA, it's nothing more then a simple:

 KILL "C:\.....\myFile.txt"

Be it a mapped network drive or local.   You also can use UNC naming:

 KILL "\\<server>\<share>\<path>\<file>"

 Jim.
0
 
LVL 38

Expert Comment

by:Jim P.
ID: 39729057
From a VBA module:
If Dir(FileName)<> "" Then
    Kill FileName
End If

Open in new window

0
 
LVL 26

Expert Comment

by:Nick67
ID: 39729781
Here's a little shim that uses the file dialog to let you select, confirm and kill a file.
The File Dialog requires a reference to Microsoft Office XX.0 Object library
(XX being 11 for A2003 -- although my machine runs A2003 and is now showing 12!)
The barest minimum I like is
Dim BuiltPath As String
BuiltPath = "Some valid path"
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(BuiltPath) Then
    fs.DeleteFile BuiltPath, True
End If

Open in new window

FileSystemObject is your friend
Murder.mdb
0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 39736895
All of these will work except if security on the drive is too high -- in recent Windows versions, I have often had problems with deleting, moving or copying files in Windows 7 (especially on Drive C).
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

752 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