An MDB contains 2 versions of the code:
- the text version (what you view and edit);
- the compiled version (the binary that actually executes.)
The compiled version is different in every version of Access. Each version
supports different features. Later versions can execute the binary from
earlier versions. But any change to the code means it has to compile again
in the new version. Now if you open this MDB in an earlier version again, it
can't use the later binary at all, and so it compiles the whole thing back
into the old version again.
All of that is supposed to occur transparently. It doesn't work 100%. You
can finish up with the old binary (or parts of it) left in the file. A
compact alone doesn't get rid of these errors. There are other things that
can cause this problem as well, such as leaving the Compile On Demand option
set (Tools | Options from the code window), editing in break mode, and other
corruptions that result in the text and compiled versions being out of sync
(various symptoms such as phantom break points, or old code still executing
after you removed it.)
A decompile instucts Access to discard the binary. When you open the
database again, it will then create the binary form the text version, and so
the 2 versions are back in sync again.
My practice is to decompile as soon as there is any clue that something's
going wrong. While developing, I'll probably decompile once a day anyway.
Once development is completed, you create an MDE (which contains only the
compiled version (not the Text version), and so cannot decompile) which
never needs decompiling.
Always create a backup before decompiling: occasionly it is the text version
that has gone bad, so when you discard the binary, you can't compile again.
At least with a bad text version, you may be able to rescue some of your
code from the gobblygook visible in the module.
So, the sequence is:
1. Backup (in case something goes wrong.)
2. Compact (to dump any deleted modules.)
3. Decompile (to dump the compiled code.)
4. Compact (to completely remove the binary.)
5. Compile (to create the binary again.)
If you have any startup code, hold down Shift during each restart, so the
code doesn't automatically get recompiled before you are ready.
Hope that explains why switching version had the effect it did, and how to
manage this.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
message