Armando wrote:
Salad,
Now that I look this code over, I think I did come across it in my
wandering. It does indeed do what my question asked, but it turns out I
didn't say it right. I haven't figured out how to get into the Form
modules, where a lot of my code lives.
It's probably just a few tweaks from this code, but I'm still green on the
structure and accessing of the Collections. I need to get another good book
on A2000, I had to leave all my references behind.
Armando
Every now and then you have to do some snipping and tucking and
modifying of what you were provided to get the answer.
I have an exitfor at the bottom you can remove if you want to cycle
through all of the forms.
I think with this code you can adjust it to go through Reports.
Unfortunately, Reports does not have an acHidden property in A97, so you
may get some flashing unless you set the echo off.
Sub FormModules()
Dim dbs As Database
Dim doc As Document
Dim frm As Form
Dim lngCount As Long
Dim lngCountDecl As Long
Dim lngI As Long
Dim strProcName As String
Dim astrProcNames() As String
Dim intI As Integer
Dim strMsg As String
Dim lngR As Long
Set dbs = CurrentDb
With dbs.Containers!Forms
For Each doc In .Documents
DoCmd.OpenForm doc.Name, acDesign, , , , acHidden
Set frm = Forms(doc.Name)
' Set form properties.
With frm
lngCount = frm.Module.CountOfLines
lngCountDecl = frm.Module.CountOfDeclarationLines
' Determine name of first procedure.
strProcName = frm.Module.ProcOfLine(lngCountDecl + 1, lngR)
' Initialize counter variable.
intI = 0
' Redimension array.
ReDim Preserve astrProcNames(intI)
' Store name of first procedure in array.
astrProcNames(intI) = strProcName
' Determine procedure name for each line after
declarations.
For lngI = lngCountDecl + 1 To lngCount
' Compare procedure name with ProcOfLine property value.
If strProcName <> frm.Module.ProcOfLine(lngI, lngR)
Then
' Increment counter.
intI = intI + 1
strProcName = frm.Module.ProcOfLine(lngI, lngR)
ReDim Preserve astrProcNames(intI)
' Assign unique procedure names to array.
astrProcNames(intI) = strProcName
End If
Next lngI
strMsg = "Procedures in Form " & doc.Name & " Module: " _
& vbCrLf & vbCrLf
For intI = 0 To UBound(astrProcNames)
strMsg = strMsg & astrProcNames(intI) & vbCrLf
Next intI
' Dialog box listing all procedures in module.
MsgBox strMsg
End With
Set frm = Nothing
DoCmd.Close acForm, doc.Name
'remove this is you want to cycle through all of the forms
Exit For
Next doc
End With
Set dbs = Nothing
MsgBox "Done"
End Sub