Gustav Brock
gustav at cactus.dk
Mon Oct 18 04:02:27 CDT 2004
Hi Dan > 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? Perhaps, but it doesn't - because you can't ask the code to compile itself. You have to run this command from a macro. We had a long thread on this and references. Look up in the archives: "Broken References in Runtime AXP and A97. Solved!" from 2003-07-23. The macro is there shown converted to VBA code. However, Marty learned us how to save and load objects as text, so here goes: Application.LoadFromText acMacro, "AutoExec", "autoexec.txt" and here is the text to save as autoexec.txt: <snip> Version = 131074 ColumnsShown = 3 Begin Action ="Echo" Argument ="0" End Begin Condition ="CheckReferences()=False" Action ="RunCode" Argument ="VerifyReferences(True)" End Begin Condition ="..." Action ="OpenModule" Argument ="USysReferencesCheck" End Begin Condition ="..." Action ="RunCommand" Argument ="126" End Begin Condition ="..." Action ="Close" Argument ="-1" Argument ="" Argument ="0" End Begin Action ="Echo" Argument ="-1" End </snip> /gustav