Gustav Brock
gustav at cactus.dk
Mon Oct 18 10:19:05 CDT 2004
Hi Dan I haven't tested this scenario. Are you sure the code is compiled when you reopen the application? The original problem was that whenever you fiddle with the references - as you do if you reestablish these after having found one or more missing reference - you wish to have the code compiled before moving on. That couldn't be done without moving the task to the AutoExec macro. /gustav > I put this code in the Click event of the system Exit button: > If CurrentPCName = "DanWaters" Then > '-- Try to compile the VBA code. If it doesn't compile, stop system > shutdown. _ > Note: If VBA code can't be compiled, no error is raised. But, > Application.IsCompiled will still be False. _ > If VBA code can be compiled, then it will be compiled and > Application.IsCompiled will then be True. > DoCmd.RunCommand acCmdCompileAllModules > If Application.IsCompiled = False Then > FormattedMsgBox GstgNotReady, "The database could not compile!@ @", > vbExclamation + vbOKOnly, "Not Compiled" > Exit Sub > End If > End If > The function CurrentPCName is my function which uses the API > GetComputerName. > It turns out that acCmdCompileAllModules really does compile code in the > current database.