I have code that works great for determining Access file version information per directory that is entered by as a string, yielding the required information for each database file in a particular directory.
I was wondering if the code could be altered to start at a directory and move through sub directories also. So instead of just finding all database files in \\server\databases\ it would continue until no sub folders exist, so typing in \\server\databases would show all database file information for that directory but would continue on to any subsequent folders that may or may not exist..
CreateMDBtable(Spath As String)
Dim Readdb As DAO.Database
Dim dbs As DAO.Database
Dim TsRec As DAO.Recordset
Dim dbreadname As String
Dim SnextFile As String
Dim fullpath As String
Set dbs = currentDb
Set TsRec = dbs.OpenRecordset("tblfiles", dbOpenDynaset)
SnextFile = Dir$(Spath & "\*.md*")
While SnextFile <> ""
fullpath = "" & Spath & SnextFile & ""
Debug.Print fullpath
Set Readdb = OpenDatabase(fullpath)
TsRec.AddNew
TsRec!fname = SnextFile
TsRec!fpath = Spath
TsRec!fversion = Readdb.Properties("accessversion").Value
TsRec!Fsize = FileLen(Readdb.Name)
TsRec!Flastdate = FileDateTime(Readdb.Name)
TsRec.Update
SnextFile = Dir$
Readdb.Close
Wend
TsRec.Close
End Sub
I was wondering if the code could be altered to start at a directory and move through sub directories also. So instead of just finding all database files in \\server\databases\ it would continue until no sub folders exist, so typing in \\server\databases would show all database file information for that directory but would continue on to any subsequent folders that may or may not exist..
CreateMDBtable(Spath As String)
Dim Readdb As DAO.Database
Dim dbs As DAO.Database
Dim TsRec As DAO.Recordset
Dim dbreadname As String
Dim SnextFile As String
Dim fullpath As String
Set dbs = currentDb
Set TsRec = dbs.OpenRecordset("tblfiles", dbOpenDynaset)
SnextFile = Dir$(Spath & "\*.md*")
While SnextFile <> ""
fullpath = "" & Spath & SnextFile & ""
Debug.Print fullpath
Set Readdb = OpenDatabase(fullpath)
TsRec.AddNew
TsRec!fname = SnextFile
TsRec!fpath = Spath
TsRec!fversion = Readdb.Properties("accessversion").Value
TsRec!Fsize = FileLen(Readdb.Name)
TsRec!Flastdate = FileDateTime(Readdb.Name)
TsRec.Update
SnextFile = Dir$
Readdb.Close
Wend
TsRec.Close
End Sub