Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / July 2005

Tip: Looking for answers? Try searching our database.

* Wildcard and FileExists

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruce - 26 Jul 2005 03:03 GMT
Can anyone tell me why the * wildcard does not work in the example below?

Rgds

Bruce

myDest = "C:\test\"      
If fs.FileExists(myDest & "*.mdb") Then
     fs.DeleteFile myDest & "*.mdb", True
End If
Ken Snell [MVP] - 26 Jul 2005 03:10 GMT
ummm... because FileExists expects to be given the full name of a single
file.

What are you wanting to do? Delete all files in a folder?

Signature

       Ken Snell
<MS ACCESS MVP>

> Can anyone tell me why the * wildcard does not work in the example below?
>
[quoted text clipped - 6 lines]
>      fs.DeleteFile myDest & "*.mdb", True
> End If
Bruce - 26 Jul 2005 03:20 GMT
Yes Ken, I would like to delete all files with a mdb extension.

Bruce

> ummm... because FileExists expects to be given the full name of a single
> file.
[quoted text clipped - 11 lines]
> >      fs.DeleteFile myDest & "*.mdb", True
> > End If
Ken Snell [MVP] - 26 Jul 2005 03:27 GMT
Then I would use a slightly different approach:

Dim strFile As String
strFile = Dir(myDest & "*.mdb")
Do While strFile <> ""
   Kill myDest & strFile
   strFile = Dir()
Loop

Signature

       Ken Snell
<MS ACCESS MVP>

> Yes Ken, I would like to delete all files with a mdb extension.
>
[quoted text clipped - 16 lines]
>> >      fs.DeleteFile myDest & "*.mdb", True
>> > End If
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.