In Access 97, changes to any module code results in the project
becoming decompiled. For best performance, it is suggested that the option
"Compile and Save All Modules" be selected in such cases.
Here's a function that could be run from anywhere in the database
and which automatically compiles and saves all code in a database.
Function fCompileProject() As Boolean
Dim db As Database
Dim ctr As Container
If Not Application.IsCompiled Then
Set db = CurrentDb
Set ctr = db.Containers!Modules
If ctr.Documents.Count > 0 Then
DoCmd.OpenModule ctr.Documents(0).Name
Else
Set ctr = db.Containers!Forms
DoCmd.OpenForm ctr.Documents(0).Name
End If
DoCmd.RunCommand acCmdCompileAndSaveAllModules
DoCmd.Close acModule, ctr.Documents(0).Name
End If
fCompileProject = Application.IsCompiled
End Function
|