|
-
Jul 19th, 2005, 09:04 AM
#1
Thread Starter
New Member
Subfolder search
Using this code - is there a way to not have to type the path everytime and be able to search all folders and sub folders for the mdb databases that have the "employees" table? I really need a good example - I am new with VBA and this works fine for me except having to type the path everytime.
Thanks.
Private Sub Form_Open(Cancel As Integer)
Dim strFile As String
Dim strPath As String
CurrentDb.Execute "DELETE * FROM tblTables"
strPath = "x:\dbases_AC\dbases\"
strFile = Dir(strPath & "*.mdb")
While strFile <> ""
CurrentDb.Execute "INSERT INTO tblTables (TableName, DatabaseName) SELECT Name,'" & strPath & strFile & "' FROM MSysObjects IN '" & strPath & strFile & "' WHERE Name = 'employees'"
strFile = Dir()
Wend
Me!Combo0.Requery
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|