"AFKAFB" <ch***********@rbos.com> wrote in
news:11**********************@f14g2000cwb.googlegr oups.com:
Bradley noted
"Access holds two versions of the code. The script and the
compiled code.
Sounds like the compiled version isn't being updated properly? "
My question is I assume the script code is the version i've
created and the compiled
code reads from this and stores it elsewhere. Where can you view
the compiled code?
You can't, and you're never supposed to be able to.
Read the article my Michael Kaplan that Doug cited
(http://www.trigeminal.com/usenet/usenet004.asp). He explains the
"11 states of compilation" that are involved behind the scenes with
all your VBA code.
You only have access to the canonical code that you type.
Theoretically, when you change the code, the next time it compiles,
it will update the compiled code to reflect the changes in the code
you typed. However, this doesn't always happen, and the result can
be code that doesn't do what you expect, invalid code that doesn't
report compile errors or code-bearing objects that are corrupted and
won't open or cause Access to crash.
Also how do you re-compile code?
On the debug menu, there should be a command for compiling code.
Before Access 2000, you could compile the open modules, or compile
all modules, or compile and save all modules. But with the new
monolithic save model implemented in A2K, that is no longer
possible, and all you have is the choice to compile the whole
project. I add this command button to my code window toolbar,
because it's imortant to force compile code often in A2K.
Also, you should go to the options for code and turn off COMPILE ON
DEMAND. What this does is reduce the number of non-requested
compiles.
But, keep in mind that any code that is called and is not compiled
will be compiled on the fly in an attempt to run it. Code-bearing
objects can open and run in an incompletely compiled state.
If you use any significant amount of code, you should definitely be
compiling your project to make sure you don't have compile errors.
You also want to be sure that all of your modules have OPTION
EXPLICIT as the second line of them (this was not the default in
A2K, in a stupid move to make A2K foolishly consistent with Word and
Excel code modules). There is also an option to set to insure that
all your modules from here on out get created with OPTION EXPLICIT.
--
David W. Fenton
http://www.bway.net/~dfenton
dfenton at bway dot net
http://www.bway.net/~dfassoc