Dan Waters
dwaters at usinternet.com
Mon Oct 18 11:53:59 CDT 2004
Hi Gustav, I just tested this when the database was not compiled, then compiled using DoCmd.CompileAllModules in the shutdown sequence. When I reopened the database it was still compiled. I haven't been doing anything with references, I just wanted to find a way to catch myself if code couldn't be compiled prior to closing the database. Dan -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Monday, October 18, 2004 10:19 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] acCmdCompileAllModules - Solved! 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. -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com