X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Decompile, Compact and Repair    
post May 15 2009, 06:59 AM

Posts: 62
Joined: 15-November 08

Everyone has their own methods of doing a decompile, compact and repair - I'm no different. This is the CMD file that I use after a day of developing. I have tried various methods, but this is the one that works the best for me. I read that the compact/repair switch is combined into one and that one of them is carried over to 2007 for compatibility, but I get better results when I separate them.
First, add a macro to your database named 'devClose' and add 'Quit' to it.
Next add this code to a CMD or a BAT file (edit paths and names as needed):
"C:\Program Files\Microsoft Office\Office12\MSACCESS.exe" /Decompile "C:\Projects\Project\Project_1_1_0.accdb" /x devClose
ping -n 5 localhost >nul
"C:\Program Files\Microsoft Office\Office12\MSACCESS.exe" /Repair "C:\Projects\Project\Project_1_1_0.accdb"
ping -n 5 localhost >nul
"C:\Program Files\Microsoft Office\Office12\MSACCESS.exe" /Compact "C:\Projects\Project\Project_1_1_0.accdb"
ping -n 5 localhost >nul

First it will open, decompile and close your database. Wait 5 seconds, repeat w/a repair, close and wait 5 seconds. Finally it will compact it, close and wait another 5 seconds.
Works great for me, hope it does for you. As always, please make sure that you have a backup before you try this or anything else posted that you find.
Go to the top of the page
Doug Steele
post May 15 2009, 07:16 AM

UtterAccess VIP
Posts: 22,184
Joined: 8-January 07
From: St. Catharines, ON (Canada)

You might want to read what MichKa has at The real deal on the /Decompile switch , specifically part at the end (RISKS TO DECOMPILE: WHY YOU SHOULD NOT USE IT CONSTANTLY).
And I think it might be better to rename the database and compact it to a different database, rather than compacting "in place": at least that way, if the compact fails, you still have the original database. Danny Lesandrini has an interesting approach at Compact an Access Database with VBS Script
Go to the top of the page
post May 15 2009, 07:20 AM

Retired Moderator
Posts: 11,289
Joined: 25-September 02
From: Milwaukee, WI

I agree - the process or steps are probably very individualistic...
This is my routine w/2007. Like most folks I have a method that I always follow. I can't say it is the *way*; only
that it (appears) to work for me.
- Close all modules / forms / reports
- Compile code
- Save file
- Compact / Repair and Close
Run /decompile and immediately close (Alt-F4).
Open file holding <Shift>. Compact / Repair.
Alt-F11 to open VBA Editor. Debug, Compile from menu and close any open modules. File/Save.
Run Compact / Repair. Optionally create .MDE/.ACCDE version.
FWIW... my latest project is A2007 and I've experienced more corruption issues than ever before. If I can identify a form or report as the problem then the undocumented Application.SaveAsText / .LoadFromText() procs work great. The /decompile switch is also valuable and has solved issues.
Orepeat as needed. On heavy development days every 30 minutes.
Go to the top of the page
post May 9 2010, 02:03 AM

Posts: 20,447
Joined: 10-January 04

Hi pacala_ba (what is your name?)
rilliant! Your instructions are so easy to follow -- like the formatting too < thank you
since you bring up SaveAsText and LoadFromText... and corruption has been discussed here ... something interesting I learned from John Viescas was that the NameSpace tag [ NameMap = Begin 0x0acc0e550000000010122cb9c383d211978d00aa00...20079000000 End] in the text file generated by SaveAsText is where AutoCorrupt puts its information. Everything can be deleted between Begin and End to attempt recovery of a corrupt form. Haven't had to try it yet myself <
Go to the top of the page
Scott McDaniel
post May 9 2010, 04:56 AM

UtterAccess VIP
Posts: 589
Joined: 18-February 09
From: North Augusta, SC

That's a neat tip - I wish I had a corrupt form I could try it on! Thanks Crystal (and John).
Go to the top of the page
post May 9 2010, 10:42 PM

Posts: 20,447
Joined: 10-January 04

you're welcome < ... and thank you, Scott <
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    23rd August 2019 - 04:34 AM