Yup -- it's pretty cool and it is a procedure in a module.
I'm in A2003, not familiar with other versions.
From the main databse menu select Insert | Module which will open the
VBA editor in a new code module, then copy and paste Arvin's text into
the code window.
You can execute it directly from the code window, or you can create a
toolbar button to run it, or ... , or ... etc! <g>
The text file I generated (I don't recall what is my code and what is
Arvin's -- my code is pasted below) helps clarify the filenames:
it looks like ~sq are queries defined 'inside of' other definitions, as
opposed to saved queries:
~sqc - lookup queries defined in table field properties (I know, I need
to lose these, Sure can learn a lot in these newsgroups!)
~sqf - forms
~sqr - reports
at least, that's what it looks like to me. I ran the code, and modified
it to create the list of object file to see what it did and haven't been
back to learn what to do with it yet ... my app is still very much under
development.
HTH
--
Clif
Option Compare Database
Public Sub DocDatabase()
'====================================================================
' Name: DocDatabase
' Purpose: Documents the database to a series of text files
'
' Author: Arvin Meyer
' Date: June 02, 1999
' Comment: Uses the undocumented [Application.SaveAsText] syntax
' To reload use the syntax [Application.LoadFromText]
' Modified by Clif McIrvin 4/08 to create __NameList.txt
'====================================================================
On Error GoTo Err_DocDatabase
Dim dbs As Database
Dim cnt As Container
Dim doc As Document
Dim i As Integer
Const DocPath = "C:\Documents and Settings\LabPC\My Documents\QC
Files\Data\Development Notes\DB Documents\"
Dim ListOnly As Integer
Set dbs = CurrentDb() ' use CurrentDb() to refresh Collections
ListOnly = MsgBox("Generate List Only?", vbYesNo, _
"Arvin's Database Documentor")
Open DocPath & "__NameList.txt" For Output As #6
Print #6, "Arvin Meyers' Database Documentor", Now
Print #6, "Current Database: "; dbs.Name
Print #6, vbCrLf; "Container = Forms"
Set cnt = dbs.Containers("Forms")
For Each doc In cnt.Documents
If ListOnly = vbNo Then
Application.SaveAsText acForm, doc.Name, DocPath & doc.Name & ".txt"
End If
Print #6, Tab(5); doc.Name
Next doc
Print #6, vbCrLf; "Container = Reports"
Set cnt = dbs.Containers("Reports")
For Each doc In cnt.Documents
If ListOnly = vbNo Then
Application.SaveAsText acReport, doc.Name, DocPath & doc.Name &
".txt"
End If
Print #6, Tab(5); doc.Name
Next doc
Print #6, vbCrLf; "Container = Macros"
Set cnt = dbs.Containers("Scripts")
For Each doc In cnt.Documents
If ListOnly = vbNo Then
Application.SaveAsText acMacro, doc.Name, DocPath & doc.Name &
".txt"
End If
Print #6, Tab(5); doc.Name
Next doc
Print #6, vbCrLf; "Container = Modules"
Set cnt = dbs.Containers("Modules")
For Each doc In cnt.Documents
If ListOnly = vbNo Then
Application.SaveAsText acModule, doc.Name, DocPath & doc.Name &
".txt"
End If
Print #6, Tab(5); doc.Name
Next doc
Print #6, vbCrLf; "Container = Query Defs"
For i = 0 To dbs.QueryDefs.Count - 1
If ListOnly = vbNo Then
Application.SaveAsText acQuery, dbs.QueryDefs(i).Name, DocPath &
dbs.QueryDefs(i).Name & ".txt"
End If
Print #6, Tab(5); dbs.QueryDefs(i).Name
Next i
Print #6,
Print #6, "End of Database: "; dbs.Name
Close #6
Set doc = Nothing
Set cnt = Nothing
Set dbs = Nothing
Exit_DocDatabase:
Exit Sub
Err_DocDatabase:
Select Case Err
Case Else
MsgBox Err.Description
Resume Exit_DocDatabase
End Select
End Sub
Option Compare Database
Public Sub DocDatabase()
'====================================================================
' Name: DocDatabase
' Purpose: Documents the database to a series of text files
'
' Author: Arvin Meyer
' Date: June 02, 1999
' Comment: Uses the undocumented [Application.SaveAsText] syntax
' To reload use the syntax [Application.LoadFromText]
' Modified by Clif McIrvin 4/08 to create __NameList.txt
'====================================================================
On Error GoTo Err_DocDatabase
Dim dbs As Database
Dim cnt As Container
Dim doc As Document
Dim i As Integer
Const DocPath = "C:\Documents and Settings\LabPC\My Documents\QC
Files\Data\Development Notes\DB Documents\"
Dim ListOnly As Integer
Set dbs = CurrentDb() ' use CurrentDb() to refresh Collections
ListOnly = MsgBox("Generate List Only?", vbYesNo, _
"Arvin's Database Documentor")
Open DocPath & "__NameList.txt" For Output As #6
Print #6, "Arvin Meyers' Database Documentor", Now
Print #6, "Current Database: "; dbs.Name
Print #6, vbCrLf; "Container = Forms"
Set cnt = dbs.Containers("Forms")
For Each doc In cnt.Documents
If ListOnly = vbNo Then
Application.SaveAsText acForm, doc.Name, DocPath & doc.Name & ".txt"
End If
Print #6, Tab(5); doc.Name
Next doc
Print #6, vbCrLf; "Container = Reports"
Set cnt = dbs.Containers("Reports")
For Each doc In cnt.Documents
If ListOnly = vbNo Then
Application.SaveAsText acReport, doc.Name, DocPath & doc.Name &
".txt"
End If
Print #6, Tab(5); doc.Name
Next doc
Print #6, vbCrLf; "Container = Macros"
Set cnt = dbs.Containers("Scripts")
For Each doc In cnt.Documents
If ListOnly = vbNo Then
Application.SaveAsText acMacro, doc.Name, DocPath & doc.Name &
".txt"
End If
Print #6, Tab(5); doc.Name
Next doc
Print #6, vbCrLf; "Container = Modules"
Set cnt = dbs.Containers("Modules")
For Each doc In cnt.Documents
If ListOnly = vbNo Then
Application.SaveAsText acModule, doc.Name, DocPath & doc.Name &
".txt"
End If
Print #6, Tab(5); doc.Name
Next doc
Print #6, vbCrLf; "Container = Query Defs"
For i = 0 To dbs.QueryDefs.Count - 1
If ListOnly = vbNo Then
Application.SaveAsText acQuery, dbs.QueryDefs(i).Name, DocPath &
dbs.QueryDefs(i).Name & ".txt"
End If
Print #6, Tab(5); dbs.QueryDefs(i).Name
Next i
Print #6,
Print #6, "End of Database: "; dbs.Name
Close #6
Set doc = Nothing
Set cnt = Nothing
Set dbs = Nothing
Exit_DocDatabase:
Exit Sub
Err_DocDatabase:
Select Case Err
Case Else
MsgBox Err.Description
Resume Exit_DocDatabase
End Select
End Sub
Leslie Porter OHV said:
WOW that looks cool. but im not sure where to load it or how to call
it...
its a module right?