Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find A Folder Programmatically

Status
Not open for further replies.

jjlogan

Programmer
Jan 11, 2002
178
US
I have researched posts on this forum and Google, but no help yet. Would appreciate your input. Using Access 2003 where the user would like to open Windows Explorer folder (or go to it) based on a text box on the current record of an Access form. Each record represents a different audit data request, and there is a folder within a tree whose root is the department share drive / Audit Requests folder. Under this root, there are subcategory folders and sub-folders. So, the program will not know the category to look under, only the left-hand characters of the folder name; will need wild card. I tried Applicaton.FileSearch with Reference set for MS Office Objects, but got error "You entered an expression that has an invalid reference to the property FileSearch." VBA input was recognizing the FileSearch properties (capitalizing them), but error stymies me. I planned to use FS to find the target, then use Hyperlink to go to the folder at the path found. Using a practice run, the following code gives the error:
Dim varItem As Variant
Dim fs As FileSearch
Set fs = Application.FileSearch
With fs
.NewSearch
.FileName = "*.mdb"
'.SearchFolders = True
.LookIn = "C:\Access2002"
.Execute
For Each varItem In .FoundFiles
Debug.Print varItem
Next varItem
End With

Thanks for any help! Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top