Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 667
  • Last Modified:

Access 2003 delete ntfs file from access macro

I need to delete a network file from a network folder from an ACCESS 2003 macro or module
0
eyes59
Asked:
eyes59
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
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
 
Jim P.Commented:
From a VBA module:
If Dir(FileName)<> "" Then
    Kill FileName
End If

Open in new window

0
 
Nick67Commented:
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
 
Helen FeddemaCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now