Solved

Access 2003 delete ntfs file from access macro

Posted on 2013-12-18
5
605 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
5 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
Comment Utility
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.
Comment Utility
From a VBA module:
If Dir(FileName)<> "" Then
    Kill FileName
End If

Open in new window

0
 
LVL 26

Expert Comment

by:Nick67
Comment Utility
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
Comment Utility
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

772 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

9 Experts available now in Live!

Get 1:1 Help Now