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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File name search problem

Status
Not open for further replies.

girlpower

Programmer
Apr 16, 2002
7
US
I work in a network environment that has a number of shared drives. I've been tasked to run an inventory on all the mdb files that are stored on these shared drives.

I can run a search in Windows that retrieves all the mdb files from the shared drives; how can I run this search from Access, take the file names, and put them into a text file to import into either Excel or Access?

Any help on this would be greatly appreciated.
 
I just copied this of MS Access example for FileSearch

You should get alot of this.

This example searches for all files that begin with "cmd" in the My Documents folder and displays the location and name of each file that's found. The example sorts the list of returned files in ascending alphabetic order, by file name.

Set fs = Application.FileSearch
With fs
.LookIn = "C:\My Documents"
.FileName = "cmd*"
If .Execute(SortBy:=msoSortbyFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top