[AccessD] VBA project corruption

MartyConnelly martyconnelly at shaw.ca
Thu Jul 6 20:28:14 CDT 2006


You can recompile directly from code see below.
You can't recompile an MDE cause there is no text source code

In Access 2000, if you Copy and Paste Forms or modules, then close
the database without compiling and saving the module, the database
file may be corrupt when it is opened next. This can occur if the
version of the file VBE6.DLL on the system is at 6.3.91.8. This can
occur if the VBE6 file has been updated by some application other
than Office/Access 2000.an example is Mappoint. Compiling and saving
the module prior to closing will resolve the issue. For more
details, please see article:

Q304548 - ACC2000: Err: Error Accessing File. Network Connection
http://support.microsoft.com/support/kb/articles/q304/5/48.asp

-------------
Turn off Compile on demand

Why does Compile On Demand increase chance of corruption?

Because it causes code outside the loaded modules to get compiled
only partially. That is, it compiles only the part that's needed to
run your code, whereas turning it off causes the whole module to
compile. This means that whole modules get compiled sooner (rather
than small chunks getting compiled when called), so you have fewer
layers of compilation.

FWIW, Michael Kaplan says certain kinds of corruption will never
happen when COMPILE ON DEMAND is off:


Public Function CompileAndSaveProject() As Boolean
'--------------------------------------------------------------------------
' An easy way to save and compile an application's modules using SysCmd()
' Source: http://www.arimsoft.ru/msaccess/
'--------------------------------------------------------------------------

SysCmd 504, 16483
'--------------------------------------------------------------------------
' SysCmd 504, 16483 fails if compile error(s) are encountered
'--------------------------------------------------------------------------
CompileAndSaveProject = Application.IsCompiled
'--------------------------------------------------------------------------
' Notify user about results of the attempt to compile/save
'--------------------------------------------------------------------------
If IsCompiled Then
MsgBox "Successfully compiled and saved all modules!"
DoCmd.Restore
Else
MsgBox "Compilation process failed due to " & vbCr & _
"non-syntax errors in source Code! " & vbCr & _
"Please use menu command " & vbCr & vbCr & _
"Debug /Compile And Save All Modules " & vbCr & vbCr & _
"to find the error!"
End If

End Function

Dan Waters wrote:

>Excellent!
>
>A couple of things you might to do:
>
>1) Always use a shortcut to open the app.  In that shortcut, include the
>/decompile after the path to your app.  So the app gets decompiled every
>time it's opened.
>
>2) In the VB window, modify the Standard toolbar.  Add a Compile button next
>to the Properties Window button.  Now you can Compile quickly whenever you
>want.
>
>Doing both of these helps a lot to keep the database small and the code
>healthy.
>
>Dan Waters
>
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Liz Doering
>Sent: Wednesday, July 05, 2006 4:28 PM
>To: Access Developers discussion and problem solving
>Subject: Re: [AccessD] VBA project corruption
>
>Andy, Bill, William and Dan,
>
>Steve handed this issue off to me--being the boss has some
>advantages--for him!  :)
> 
>Turns out, this is a .dll problem, not an actual object corruption
>problem.  Microsoft explains it all here:
>http://support.microsoft.com/?scid=kb;EN-US;304548. 
> 
>I didn't like the solutions they offered, which included exporting
>objects to text files and reimporting them.  There are nearly 900 forms,
>reports and modules in this .mdb!  Using the advice from
>http://www.granite.ab.ca/access/decompile.htm, I made a .bat file to
>decompile with 2003, ("C:\Program Files\Microsoft
>Office\OFFICE11\MSAccess.exe" /decompile).  Once the decompile had run
>(a long time), I saved the file to 2003 format and all was well.   
>
>I imagine that this is because 2003 is playing nicely with version
>6.3.91.8 of the Vbe6.dll file, unlike 2000.  But I don't understand why
>just opening the thing in 2003 didn't have the same effect.  
>
>Thanks for all your help!
>
>
>
>Liz Doering
>Symphony Information Services
>ldoering at symphonyinfo.com
>www.symphonyinfo.com
>763-391-7400 x802
>
> 
>
>
> 
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve
>Capistrant
>Sent: Wednesday, July 05, 2006 10:01 AM
>To: Access Developers discussion and problem solving
>Subject: Re: [AccessD] VBA project corruption
>
>Andy,
>I did try decompiling, using this syntax from a RUN window:
>[path and file for MSAssess.exe] /decompile [path and file for my mdb].
>
>Not sure if I constructed that correctly.  But it appeared to chug along
>and do something, but then ended up with the same VBA Corrupt message.
>
>Steve 
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
>Sent: Wednesday, July 05, 2006 9:31 AM
>To: Access Developers discussion and problem solving
>Subject: Re: [AccessD] VBA project corruption
>
>Steve, have you tried decompiling?
>--
>Andy Lacey
>http://www.minstersystems.co.uk
>
>
>--------- Original Message --------
>From: "Access Developers discussion and problem solving"
><accessd at databaseadvisors.com>
>To: "Access Developers discussion and problem solving"
><accessd at databaseadvisors.com>
>Subject: [AccessD] VBA project corruption
>Date: 05/07/06 14:15
>
>
>A nice, long productive holiday weekend working on my Access 2000 mdb...
>Then yesterday I open the file and get "The Visual Basic for
>Applications in this project is corrupt." Sigh.
>
>I can shift bypass in to see objects. But completely unable to run
>anything with code, nor can I even view code. Ran Repair and Compact to
>no avail.
>
>Normally in these situations, I start a new MDB, then import all objects
>from the corrupt DB. But here, even the import function fails (same
>error message) when I point it to the corrupt db.
>
>I have heard of (but never used) third party utilities that work some
>magic. Any advice? I'd love not to have lost many hours of work.
>
>Thank you.
>
>Steve Capistrant
>Symphony Information Services
>scapistrant at symphonyinfo.com
>www.symphonyinfo.com
>Office, Twin Cities: 763-391-7400, ext. 801.
>Office, Toll free: 888-357-1373, ext. 801
>Direct: 612-237-0075
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada




More information about the AccessD mailing list