Need a search function to find an Access component within an mdb

L

Larry Kahm

Client claims he made a prototype of a new form in an A2000 database. Can't
remember which of the dozens of development mdbs it could be in.

Windows Search doesn't seem capable of finding a form name within an mdb
file.

Does anyone have any suggestions - aside from opening each database and
looking (and I don't really want to do that because it changes the date last
used, and that's a whole 'nother story for this guy) - for a search utility
that can find it?

Thanks!

Larry Kahm
Heliotropic Systems, Inc.
 
B

Brendan Reynolds

This is a quick example that doesn't deal with all of the issues that might
arise, but perhaps it might serve to get you started ...

Public Function FindForm(ByVal DirName As String, ByVal FormName As String)
As String

Dim strFile As String
Dim db As DAO.Database
Dim docs As DAO.Documents
Dim doc As DAO.Document

strFile = Dir(DirName & "\*.MDB")
Do Until strFile = vbNullString
Set db = DBEngine.OpenDatabase(strFile)
Set docs = db.Containers("Forms").Documents
For Each doc In docs
If doc.Name = FormName Then
FindForm = db.Name
Exit For
End If
Next doc
db.Close
strFile = Dir()
Loop

End Function

Example of use, in Immediate window ...

? findform("c:\documents and settings\brendan reynolds\my documents",
"Form1")
C:\Documents and Settings\Brendan Reynolds\My Documents\trains.mdb
 
L

Larry Kahm

Brendan

Thanks - that'll work and it's less expensive than purchasing some
third-party product.

Now, to copy all those mdbs to another folder so that I can "safely" change
the time stamps.

Larry Kahm
Heliotropic Systems, Inc.
 

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