Directory search
I need to search a drive and all Folders under that drive and look in each mdb. database to see if it has a table called "Employees" --- If it has such a table I want the full path & name of that database to be added to the table (probably just the database location)
I am new with VBA and need some help. The code below works fine to get all the tables but I need to only find the one table. I am open to other suggestions.
Private Sub Form_Open(Cancel As Integer)
Dim strFile As String
Dim strPath As String
CurrentDb.Execute "DELETE * FROM tblTables"
strPath = "c:\" 'Change the path to whereever you need it to be
strFile = Dir(strPath & "*.mdb")
While strFile <> ""
CurrentDb.Execute "INSERT INTO tblTables (TableName, DatabaseName) SELECT Name,'" & strPath & strFile & "' FROM MSysObjects IN '" & strPath & strFile & "' WHERE Left$(Name,1)<>'~' AND Type=1"
strFile = Dir()
Wend
Me!Combo0.Requery
End Sub
I am using Access2000
|