Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access 2003 delete ntfs file from access macro

Posted on 2013-12-18
5
Medium Priority
?
657 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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…

604 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