Re: summary of db content
- From: "Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx>
- Date: Wed, 9 Aug 2006 08:45:24 -0400
Thanks, John. I knew it was something relatively simple, but I couldn't find
the correct property to use.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"John Spencer" <spencer@xxxxxxxxx> wrote in message
news:OZDW916uGHA.4752@xxxxxxxxxxxxxxxxxxxxxxx
Here is some code to get you started on getting the lines of code in areports
database.
Sub LinesOfCode()
Dim db As Database
Dim Doc As Document
Dim mdl As Module
Dim lngCount As Long
Dim lngFormsCode As Long
Dim lngReportsCode As Long
Dim i As Integer
Dim strForm As String
Set db = CurrentDb()
' count module LOC
For Each Doc In db.Containers("Modules").Documents
DoCmd.OpenModule Doc.Name
Set mdl = Modules(Doc.Name)
lngCount = lngCount + mdl.CountOfLines
Debug.Print mdl.CountOfLines, Doc.Name
Set mdl = Nothing
DoCmd.Close acModule, Doc.Name
Next
Debug.Print lngCount & " lines of code in Modules."
' count Code in Forms
For i = 0 To db.Containers("Forms").Documents.Count - 1
strForm = db.Containers("Forms").Documents(i).Name
DoCmd.OpenForm strForm, acDesign
lngFormsCode = lngFormsCode + Forms(strForm).Module.CountOfLines
Debug.Print strForm, Forms(strForm).Module.CountOfLines
DoCmd.Close acForm, strForm, acSaveNo
Next
Debug.Print "forms code = " & lngFormsCode
' count LOC in Reports
For i = 0 To db.Containers("Reports").Documents.Count - 1
strForm = db.Containers("Reports").Documents(i).Name
DoCmd.OpenReport strForm, acViewDesign
Reports(strForm).Visible = False
lngReportsCode = lngReportsCode + Reports(strForm).Module.CountOfLines
Debug.Print strForm, Reports(strForm).Module.CountOfLines
DoCmd.Close acReport, strForm, acSaveNo
Next
Debug.Print "reports code = " & lngReportsCode
Debug.Print "total = " & lngFormsCode + lngCount + lngReportsCode
End Sub
"Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx> wrote in message
news:eY32XUzuGHA.1504@xxxxxxxxxxxxxxxxxxxxxxx
Number of tables, number of forms, number of queries and number of
theare easy.
CurrentDb.TableDefs.Count and CurrentDb.QueryDefs.Count will give you
neednumber of tables and the number of queries respectively. Unfortunately,
the Forms and Reports collections only contain those Forms and Reports
that are currently open, so it's a little more involved for them: you
toto use CurrentDb.Containers("Forms").Documents.Count and
CurrentDb.Containers("Reports").Documents.Count respectively.
Number of fields withint each table is a bit more involved. You'd have
somethingloop through all of the tables and get the number of fields in each:
Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef
Dim lngTotalFields As Long
lngTotalFields = 0
Set dbCurr = CurrentDb()
For Each tdfCurr In dbCurr.TableDefs
lngTotalFields = lngTotalFields + tdfCurr.Fields.Count
Next tdfCurr
Lines of code is possible as well, but unfortunately I've forgotten how.
(Of course, it's a pretty meaningless measure of anything...)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Daniel" <Daniel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:49033DA8-9BD2-45F1-B394-61A8C15BF297@xxxxxxxxxxxxxxxx
Good afternoon,
Is there a simple way to extract a summary of a db's content.
along the lines of:
-Number of Tables
-Number of fields within each table
-Number of Forms
-Number of Queries
-Number of Report
And is there a way to determine the number of lines of code within a db
(modules, forms... everything combined)?
Thank you,
Daniel
.
- References:
- Re: summary of db content
- From: Douglas J. Steele
- Re: summary of db content
- From: John Spencer
- Re: summary of db content
- Prev by Date: Re: Update Date Prompt field
- Next by Date: Storing Word Document in D
- Previous by thread: Re: summary of db content
- Next by thread: Re: summary of db content
- Index(es):
Relevant Pages
|