Dan Waters
dwaters at usinternet.com
Mon Oct 18 09:53:04 CDT 2004
Gustav & Marty, 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. Thanks for your help! Dan -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of MartyConnelly Sent: Monday, October 18, 2004 1:30 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] acCmdCompileAllModules You could try these http://www.access.vis.pl/af0424a.htm My Polish is lousy. NB. IMPORTANT These undocumented commands should only be attempted by fully qualified stunt driver. ' Call a hidden SysCmd to automatically compile/save all modules. Call SysCmd(504, 16483) or you could also try Application.IsCompiled I have heard this maynot work in cases where you don't have full permissions to all objects in the database.Linked tables maybe? Polish List SysCmd(7) 'Detects the Access VERSION number For Access 97: SysCmd 603, PathMdb, PathMde 'convert MDB -> MDE SysCmd 602, PathMdb, PathMdb 'compact DB SysCmd 555 'create MSysIMEX... tables SysCmd(504, 16483) 'save and compile code SysCmd(504, 16484) 'save code without compiling SysCmd(501, i) 'list of references, i = 0, 1, ... n SysCmd(500) 'count of references For Access 2000+: SysCmd 603, PathMdb, PathMde 'convert MDB -> MDE SysCmd 602, PathMdb, PathMdb 'compact DB 'You must use in this case following method, example: Dim accApp As Access.Application Set accApp = New Access.Application accApp.SysCmd 603, PathMdb, PathMde accApp.SysCmd 602, PathMdb, PathMdb Set accApp = Nothing SysCmd(605, 0) 'convert DB to previous version SysCmd(605, "C:\Database97.mdb") 'convert DB to previous version SysCmd(607,"C:\Project1.adp") 'convert DB to ADP project SysCmd(608, i) '60 tips about Access programming for i=0, 1, ... 60 SysCmd(710, 68486165) 'set Polish keyboard (if installed) SysCmd(710, 67699721) 'set US keyboard SysCmd(710, 68748313) 'set Russian keyboard SysCmd(710, 67634184) 'set Greek keyboard SysCmd(710, ...) 'set other country keyboard SysCmd(710,1) 'set next installed keyboard SysCmd(710,0) 'set previous installed keyboard SysCmd(711) 'return put keyboard currently SysCmd(714) 'returns TRUE, if any form, report, macro or module is in design mode SysCmd(715) 'returns Build number of MSACCESS.EXE file to check Access version or e.g. which Service Pack is installed. Dan Waters wrote: >Has anyone tried this? > > > >DoCmd.RunCommand acCmdCompileAllModules > > > >I wanted to use it to detect any compile errors before shutting down my >development database. I tested with a misspelled keyword (DoCmd.Close >acformX, "frmMyForm"), and this was not detected by the compile command. Of >course if I click the compile button it is detected. > > > >Should this work as I'm expecting? > > > >Dan Waters > >ProMation Systems, Inc. > > > -- Marty Connelly Victoria, B.C. Canada -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com