[求助]Access自动添加代码
帮我看看这段代码
我要在80多个Form里每个Form的beforeupdate加入相同的代码,代码保存在d:\addproc.txt,以下是我试着写的代码,但没通过,请高手看看
Function AllForms() As Boolean
On Error GoTo Err:
Dim frm As AccessObject, mdl As Module
' Search for open AccessObject objects in AllForms collection.
For Each frm In CurrentProject.AllForms
Debug.Print frm.Name
Set mdl = frm.Module
mdl.AddFromFile ("d:\addproc.txt")
' Modules(obj.Module).AddFromFile "d:\addproc.txt"
Next frm
AllForms = True
Exit Function
Err:
MsgBox (Err.Description)
AllForms = False
End Function