Yes, decompile is a useful technique to solve a particular kind of
corruption with Access databases.
An MDB contains 2 copies of your VBA code:
- the text version (what you read and edit);
- the code version (what actually executes).
Under certain circumstances, these 2 can get out of sync, so that what is
running does not match the code you are viewing. A decompile instructs
Access to discard the compiled version. Then when you start the database
again, it recreates the compiled version out of the text, and the sync
problems are gone.
It is always good practice to back up before a decompile. If it were the
text copy that was damaged, a decompile could make things worse. In practice
this is rare (especially as you can see the problem in the text version.)
You probably want to compact immediatedly after a decompile to regain the
space that was occupied by the compiled code.
As to what causes this kind of corruption, without evidence I suspect that
editing a module while it is executing (i.e. in break mode) is a
contributing factor. When you begin editing, Access creates another temp
copy of the form and its module (so you can revert to the saved copy.) It is
now trying to balance 4 copies of the code. If this happens while the form
is open (not in design view) and the code is running, it appears that Access
gets confused between the different copies. The only evidence I have for
this is circumstantial, i.e. electing to always switch to design view before
editing prevented about 2/3 of the corruptions of this type that I
experienced.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"MLH" <CR**@NorthStat e.net> wrote in message
news:so******** *************** *********@4ax.c om...
Can decompiling an A97 mdb result in fixing minor nasties that may be
responsible for some premature terminations of A97 (We are sorry. MS
Access 97 needs to close.... messages). I've found the following
recommendation and was wondering if any of you have used the
technique and why you did?
To decompile start Access with the /decompile switch. To do this from
windows do a Start, Run and then where it asks for the name of the
program to run type:
"c:\program files\microsoft office\office\m saccess.exe" /decompile
Make sure you include the quotes as above. Also modify the file path
if necessary to point to where msacess.exe is located (if it is
different in your installation). When Access starts select/open the
mdb you want to decompile. (the first mdb you open after starting
Access in this fashion will get decompiled). Then compact the
database (tools, Database Utilities, Compact and Repair). Then open
up any module and do a menu Debug, Compile. Then close the module.
Then compact the database again.