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

FileSearch results

Status
Not open for further replies.

gkoster

Programmer
Joined
Jul 11, 2001
Messages
1
Location
US
I have an Access 97 application that displays all of the databases in a particular directory by parsing through the FileSearch results. Unfortunately, on WindowsNT it includes the targets of any shortcuts as well.

For instance, in one directory I have the following files...

MyAccessDB.mdb
MyAccessDBShortcut (points to previous file)
MyRouterShortcut.mdb (points to a networked db)

When I run the FileSearch routine, I get all three files. Here's the code that I use in the file search...

Set objFS = Application.FileSearch
With objFS
If (iFile < 2) Then
.NewSearch
End If
.LookIn = lDir
.FileName = sExt
.FileType = msoFileTypeAllFiles
.MatchTextExactly = True
.SearchSubFolders = True
If .Execute(SortBy:=msoSortByFileType, SortOrder:=msoSortOrderAscending) > 0 Then
For i = iFile + 1 To .FoundFiles.Count

tFile = &quot;&quot;
tFile = Dir(.FoundFiles(i))
If (UCase(Left(.FoundFiles(i), Len(lDir))) <> UCase(lDir)) Then
GoTo NextFile
End If
If (Len(Trim(tFile) & &quot; &quot;) > 1) Then
HPC_GetAllFiles = .FoundFiles(i)
iFile = i
GoTo GetOutOfHereAndCloseDown
End If
NextFile:
Next i
Exit Function
End If
End With
Set objFS = Nothing

(I should point out that the &quot;sExt&quot; variable coming into the search containts &quot;*.mdb;*.mde;*.mda;&quot;.)

What am I doing wrong? Glenn J. Koster, Sr.
High Plains Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top