ðH geocities.com /Heartland/Pond/4805/Form14.htm geocities.com/Heartland/Pond/4805/Form14.htm .delayed x ÀPÔJ ÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ Ð®ì C6 OK text/html €çh C6 ÿÿÿÿ b‰.H Sun, 20 Jan 2002 13:01:02 GMT D Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98) en, * ÀPÔJ C6
ACC2000: Sample Procedure to Find the Location or Locations of a File |
The information in this
article applies to:
Advanced: Requires expert
coding, interoperability, and multiuser skills.
This article applies to a Microsoft Access database (.mdb) and a Microsoft
Access project (.adp).
This article describes how to create a sample
user-defined function that uses the FileSearch object contained in the Application
object to locate a file on a particular drive.
The LocateFile() function takes the file that
you are looking for as a string argument and returns all locations of that
file. To create this function, follow these steps:
Option Explicit
Function LocateFile(strFileName as String)
Dim vItem As Variant
With Application.FileSearch
.FileName = strFileName
.LookIn = "C:\"
.SearchSubFolders = True
.Execute
For Each vItem In .FoundFiles
Debug.Print vItem
Next vItem
End With
End Function
?LocateFile("Northwind.mdb")
Note that all locations
of Northwind.mdb are printed in the Immediate window.