[Webinar] Streamline your web hosting managementRegister Today

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

Correct way to kill

Experts,
The below code works. Now what I now need to do is delete the file after I have transferred the data to Access.
After I execute my DoCmd TransferSpreadsheet statement is this all I need to do to delete the file?

Kill fileName
=========================================
With Application.FileDialog(msoFileDialogOpen)
    .Title = "Select File"
    .Filters.Add "Excel Files", "*.xls"
    .InitialFileName = "D:\WilliamsSonoma\OB4"
    result = .Show
    fileName = Trim(.SelectedItems(1))
     
End With

   DoCmd.SetWarnings False
   DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "tblLaborMgmtDataImport", fileName, True, "Sheet1!A:G"
====================================================================
0
Frank Freese
Asked:
Frank Freese
1 Solution
 
Rey Obrero (Capricorn1)Commented:
you just need

Kill fileName    

filename is the complete path to your file
0
 
dqmqCommented:
Yes. Is it not working?
0
 
Shanmuga SundaramDirector of Software EngineeringCommented:
Kill "Filename with path" will work as capricorn1 suggests. Eg: Kill "C:\test.txt". if not you can also use filesystem object to delete a file.Hope this will help you if you want to delete using FSO.

http://www.rondebruin.nl/folder.htm
0
 
Frank FreeseAuthor Commented:
again, many thanks. just wanted to be right before being stupid.
0

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