P
Phil
My ultimate goal is to be able to completely map out an Access db: tables,
queries, forms, reports, macros, modules with all the included
controls/properties/VBA code. I can dig deep into these top 6 objects within
a db but this requires the code to be included in the db I am mapping. That
would defeat the whole purpose. The following code does work for getting a
list of forms from another db (I can write similar code for reports, tables,
etc.).
*****************
Public Sub GetFormInfo(dbFullName As String, tblForm As String)
' dbFullName = the name of the db being mapped
' tblForm = the name of a table with a text field "FormName"
Dim db As Database, dbBrowse As Database
Dim rs As Recordset
Dim objCon As Container
Dim objDoc As Document
Set db = CurrentDb()
Set rs = db.OpenRecordset(tblForm, dbOpenDynaset)
Set dbBrowse = OpenDatabase(dbFullName)
With dbBrowse
For Each objCon In .Containers
If objCon.Name = "Forms" Then
For Each objDoc In objCon.Documents
rs.AddNew
rs("FormName") = objDoc.Name
rs.Update
Next
End If
Next
.Close
End With
rs.Close
db.Close
End Sub
*****************
I'd appreciate some success stories (with code), pointers in the right
direction, etc.
queries, forms, reports, macros, modules with all the included
controls/properties/VBA code. I can dig deep into these top 6 objects within
a db but this requires the code to be included in the db I am mapping. That
would defeat the whole purpose. The following code does work for getting a
list of forms from another db (I can write similar code for reports, tables,
etc.).
*****************
Public Sub GetFormInfo(dbFullName As String, tblForm As String)
' dbFullName = the name of the db being mapped
' tblForm = the name of a table with a text field "FormName"
Dim db As Database, dbBrowse As Database
Dim rs As Recordset
Dim objCon As Container
Dim objDoc As Document
Set db = CurrentDb()
Set rs = db.OpenRecordset(tblForm, dbOpenDynaset)
Set dbBrowse = OpenDatabase(dbFullName)
With dbBrowse
For Each objCon In .Containers
If objCon.Name = "Forms" Then
For Each objDoc In objCon.Documents
rs.AddNew
rs("FormName") = objDoc.Name
rs.Update
Next
End If
Next
.Close
End With
rs.Close
db.Close
End Sub
*****************
I'd appreciate some success stories (with code), pointers in the right
direction, etc.