File search

G

GordonP

I'm creating an Access application in which the user can select a bitmap
file from many that might exist on the hard drive. My code so far uses a
callback function to fill a list box that contains file names. The callback
function uses the FileSearch object to find files. The code for the the
FileSearch object contains:
With Application.FileSearch
.NewSearch
.FileName = "*.bmp"
.LookIn = "C:\"
.SearchSubFolders = True
.FileType = msoFileTypeAllFiles
.Execute
End With
My problem is that FileSearch seems to search my hard drive until it finds
the first subfolder that contains a .bmp file, lists .bmp files in that
subfolder and its subsidiary subfolders, then quits. It doesn't go back to
the root folder and search for .bmp files in other subfolders, as I expected
and need.
I shall appreciate any suggestions about how I can create a list of .bmp
files that exist in any folder on the hard drive.

GP
 
G

GordonP

Allen:
I've been trying out your suggestion. With one exception, it works fine.
The exception is when I select the root folder (C:\) to search and set
IncludeSubFolders to True. In that case, I consistently get the error
message "Error 52: Bad file name or number."
It seems there is a problem in the second part of the FillDir function
(starting with If bIncludeSubFolders). I've spent a while trying to find how
the problem occurs, but haven't successful so far. Any suggestions.

GordonP
 
A

Allen Browne

Hmm. I can't see why it won't work for the root folder.

Does it need admin rights to be able to do this?
Or are there virtual folders you don't have permission to access?
 
G

GordonP

I don't think Adnin rights or virtual folders are a problem.

I'm inclined to think that the recursive structure causes running out of
system resources due to the large number of folders and subfolders that are
accessible from the root directory.

I'm hoping to take time during the next few days to modify what you have
suggested without using recursion. I'll keep you informed.

GordonP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top