[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Search Server For MDB Files

Posted on 2000-02-09
8
Medium Priority
?
360 Views
Last Modified: 2006-11-17
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?
0
Comment
Question by:ssteeves
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 9

Expert Comment

by:BrianWren
ID: 2503702
It's not that easy!

I'll look into it a bit.

Brian
0
 
LVL 10

Accepted Solution

by:
paasky earned 200 total points
ID: 2503729
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
 
LVL 9

Expert Comment

by:BrianWren
ID: 2503877
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 5

Expert Comment

by:KMAN
ID: 2504206
Paasky

Is 'fs' a recordset?
0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2504239
fs is an object.

      Dim fs as Object

      Set fs = Application.FileSearch
      With fs
          ...
0
 
LVL 5

Expert Comment

by:KMAN
ID: 2504255
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
 
LVL 10

Expert Comment

by:paasky
ID: 2504344
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
 
LVL 1

Author Comment

by:ssteeves
ID: 2505004
Thanks!
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Case Study of using the Windows API to provide RS232 communications capability in Access without the use of Active-X controls.
Audit trails are very important in any system to hold people responsible for certain transactions and hold them to take ownership of their actions. This article is dedicated to all novice "Microsoft Access" developers.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

608 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question