How much code have I got?

MLUCKHAM

Registered User.
Local time
Today, 20:24
Joined
Jul 23, 2013
Messages
89
I have been working on a pretty big Access Database for a while now and it is coming to an end in terms of dev.

I wanted to get some stats on how many lines of code the database has.

I wrote a simple procedure to do this: -

Code:
Private Sub Command0_Click()
Dim mrd As Module
Dim NumLines As Long

For i = 0 To Application.Modules.Count - 1
    Set mrd = Application.Modules(i)
    Debug.Print mrd
    NumLines = NumLines + mrd.CountOfLines
Next
    
MsgBox NumLines


End Sub

This works, but only if the module has been opened by me! So, if I go through and manually open up all the modules for each of the forms the module count is updated and the modules line count is available.

Does anyone know how I can get this to work for ALL modules without me needing to open them up... manually!
 
27,585 (and counting...)

But I like to think my target is to keep the number of lines to a minimum rather than making it larger? If I can do something in 10 lines rather than 20 then I consider that a positive! Ultimately, the success of the DB is how quickly and efficiently it can manage your data, not how many lines of code it has...

(That said - I know what you mean - it's strangely gratifying to know you can put so much code together and it all works and doesn't fall down!)
 
27k, good effort! Hey, 2 years of graft has gone into my DB. Not saying it is perfect and that there is not code that needs to probably come out, but as Access DB's go I am pretty chuffed with over 50k...
 
just tried it on one of my bigger apps, and beat you!

129250 lines

(comes in at about 60Mb)

out of interest if you add doevents at the bottom of the function getmodulelines() it will keep the display tidier.

I also added an output log to write it all out to a text file.
 
Ugh. Out of curiosity I checked the number of lines in an app I've been working on over the last year that is effectively a glorifed parser - with the condition that every single file we receive from the state has unique requirements, even though they're supposed to be one standard format.

~10,000 lines. For a freaking parser that takes spreadsheets and converts them to a delimited text file. :banghead:
 

Users who are viewing this thread

Back
Top Bottom