By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,473 Members | 1,278 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,473 IT Pros & Developers. It's quick & easy.

Using code to delete a file

P: 23
Is there a way to use code in access to delet a file?
I have set up code to transfer a query to am excel workbook and format the sheet. but in the process excel creates a backup copy in the same folder. Is there a way to either not create the backup copy or delete it, without opening the folder selecting the file and deleting.
Mar 3 '14 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 8,701
It is a relatively straightforward thing to do:
Expand|Select|Wrap|Line Numbers
  1. 'Absolute PATH to the File to DELETE
  2. Const conFILE_TO_DELETE As String = "C:\Test\Backup.xls"
  4. If Dir(conFILE_TO_DELETE) <> "" Then    'If File exists, DELETE it
  5.   Kill conFILE_TO_DELETE
  6. End If
Mar 3 '14 #2

P: 23
I will give this a try,
Mar 6 '14 #3

Post your reply

Sign in to post your reply or Sign up for a free account.