Search Server For MDB Files

I want my program to search for any MDB files on the server.  I tried using the DIR function, but I can't get it to search Subdirectories.  This is probably an easy task, but I don't have enough time to devote to it.   Does anyone know how to do this?
LVL 1
ssteevesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BrianWrenCommented:
It's not that easy!

I'll look into it a bit.

Brian
0
paaskyCommented:
Hello ssteeves,

Try this:

Set fs = Application.FileSearch
With fs
    .LookIn = "C:\Omat tiedostot"
    .SearchSubFolders = True
    .FileName = "cmd*"
    If .Execute() > 0 Then
        MsgBox "Tiedostoja löytyi " & _
           .FoundFiles.Count & " kappale(tta)."
        For i = 1 To .FoundFiles.Count
            MsgBox .FoundFiles(i)
        Next i
    Else
        MsgBox "Tiedostoja ei löytynyt."
    End If
End With

sorry it's Finnish ;)


Regards,
Paasky
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BrianWrenCommented:
If you use

    Dir("*.", vbDirectory)

you will get a subdirectory of the CurDir.  Repeated calls to Dir (no arguments) will return other subdirectories.

If you do this till Dir returns an empty string, you can get a list of the subdirectories of your current path.

Storing these, you can then, one at a time, search those subdirectories for subdirectories.  And so on.  This would be a good place for recursion, but be careful if you do use recursion...

Brian
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

KMANCommented:
Paasky

Is 'fs' a recordset?
0
BrianWrenCommented:
fs is an object.

      Dim fs as Object

      Set fs = Application.FileSearch
      With fs
          ...
0
KMANCommented:
Thanks.  Function is also in help file with the DIM's needed, kind of goofy if you ask me.

Ran it, and it returned 1 file, even though using Windows "Find..."  I locate a total of 8.  Gonna keep working on it, I think it will do what ssteeves wants, and what I want.

Thanks!
0
paaskyCommented:
Brian, thank you for your co-operation. ;)

I was concentrating my real work (which I also get paid) so much I didn't notice new comments.

You can find more information from Access Help using keywords "FileSearch","NewSearch".  

Regards,
Paasky
0
ssteevesAuthor Commented:
Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.