Access MVP (2010-2015)

oOo.oOo.oOo.oOo.oOo.oOo

Compile on Demand check or uncheck?

CompileOnDemand

Recently, while trying to Debug some code a colleague of mine suggested I leave Compile on Demand1 unchecked.  Since in all my years of developing I have always left it checked, I asked why and here’s what he said got…

Many years ago, Michael Kaplan mentioned that this setting was known to cause problems, at a Pacific NW Access Developer’s Group meeting.

Here is how having this Option checked can bite you in the patooka’s!  Suppose you have unfinished code, or some other compile error, in code that you are not currently using. You forget to do a final Debug > Compile, to force all code to Compile. You deliver your app. to your customer. They immediately get a Run-Time error, with the same unused code. Why?  Because this setting does not “travel” with your database; it is a global VBA environment setting. With this Option unchecked, ALL code must be compilable before any code can be run. Checking this option (the stupid default setting), allows for partial compliable; in other words, only the Modules that have code that you are running must be compilable. You could still have that experimental new module with code that does not Compile. Personally, I’d rather find these issues myself, instead of having a customer find them.  <smile>

Additional comments here…  Say it aint’s so, Joe.

Now, with that being said, I am still leaving mine checked (and I am not alone), not because I like to skirt danger but because I Compile my code if I just look at it.  (Though nothing to do if you make no change, I check anyway.)  So, the choice is up to up but I would heed the advice if you are not *religious* about Compiling your code!

 1,385 total views,  2 views today

Comments are closed.