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
'No Modules present, try Forms container
Set ctr = db.Containers!Forms
'no need to check for count since this code
'itself must be present *somewhere*
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
|