1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| Public Sub EnrichirFormModDico()
On Error Resume Next
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
Dim oStartLine As Long
Dim oCountLines As Long
Dim strProcBody As String
Set dbs = CurrentDb
DoCmd.RunSQL "DELETE * FROM NOMFORMMODDICO;"
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
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
'Determine procedure name
strProcName = frm.Module.ProcOfLine(lngI, lngR)
'Determine procedure string for strProcName
oStartLine = frm.Module.ProcStartLine(strProcName, vbext_pk_Proc)
oCountLines = frm.Module.ProcCountLines(strProcName, vbext_pk_Proc)
strProcBody = frm.Module.Lines(oStartLine, oCountLines)
'Remplir la table NOMFORMMODDICO
Dim str As String
str = "INSERT INTO NOMFORMMODDICO VALUES (" & _
MAJTexte(doc.Name) & "," & _
MAJTexte(frm.Module.Name) & "," & _
MAJTexte(strProcName) & "," & _
MAJTexte(strProcBody) & ")"
DoCmd.RunSQL (str)
End If
Next lngI
End With
Set frm = Nothing
DoCmd.Close acForm, doc.Name
Next doc
End With
Set dbs = Nothing
End Sub |
Partager