Results 1 to 4 of 4
  1. #1
    orcinus is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    67

    How to tell if a file exists and then delete it


    Using Access 2003..

    Using VBA, would like to first check to see if a file exists, say on my C drive and then if it does, delete it..

    Also, would like the check/delete to involve a partial variable file name, so that the file will always have the format:

    killerwhales_mmddyy.txt

    where mmddyy will always be variable, so my delete should be something along the lines of delete killerwhales_*.txt

    Not sure at all how to go about this, so any help is greatly appreciated..

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Use VBA Help to look up the Dir() and Kill functions.

  3. #3
    orcinus is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    67
    Quote Originally Posted by RuralGuy View Post
    Use VBA Help to look up the Dir() and Kill functions.
    Cool, found it, thanks!

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    When you get things working then follow the link in my sig for directions on how to mark this thread as Solved.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. if exists UPDATE else INSERT
    By lloyddobler in forum Programming
    Replies: 18
    Last Post: 01-04-2012, 11:35 PM
  2. Add columns if not exists
    By ysrini in forum Access
    Replies: 1
    Last Post: 02-16-2010, 06:39 PM
  3. How to use if not exists in access?
    By halifaxdalRaymondXie in forum Queries
    Replies: 1
    Last Post: 01-14-2010, 03:18 PM
  4. Replies: 0
    Last Post: 09-18-2009, 07:33 AM
  5. Create Table If Not Exists
    By jp2access in forum Queries
    Replies: 7
    Last Post: 07-14-2009, 12:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums