Database / forms corrupt - decompile doesn't help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have received a database from another consultant which has been edited in
more than one version of MS Access. It seems that the forms are corrupt as
they keep trying to call VBA code or macros that are in the database but not
called at the time. I have tried to fix the corruption by : 1) Decompiling
(several times) 2) Creating a new form and importing most but not all the
objects and recreating the troubled objects, 3) creating a new database and
importing the objects that I thought were not corrupted and leaving out the
ones that were corrupt. Every time I think that things are OK then a new
corruption problem pops up. Any ideas????
Thanks, Margaret
 
Margaret, I don't think I can give you a specific answer, because the issue
you describe is quite general.

Try this sequence in this order:

1. Whatever version of Access you are using, make sure you have applied the
latest service pack for Office and also for JET 4 from:
http://support.microsoft.com/gp/sp
Do not continue with the following steps until you are certain you have SP8
for Jet 4 installed, and the correct service pack: SP1 for Office 2003, or
SP3 for Office 2000 or XP.

2. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

3. Compact the database:
Tools | Database Utilities | Compact

4. Close Access. Make a backup copy of the file. Decompile the database by
entering something like this at the command prompt while Access is not
running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

5. Open Access, and compact again.

6. Create a new (blank) database.

7. Turn off the Name AutoCorrect options in the new database.

8. Press Ctrl+G to open the Immediate Window.
Choose References from the Tools menu.
Uncheck any references you do not need.
For a list of the ones you typically need in your version of Access, see:
http://allenbrowne.com/ser-38.html

9. Now import the objects that you know are okay:
File | Get External | Import

10. Close Access, and make a backup copy at this point, so you can pick up
from here again if something stilll goes wrong after this.

11. Open the database, and open the Immediate Window.
Choose Compile from the Debug menu.
Fix any errors, and repeat until the code compiles okay.

12. Begin importing the suspect objects, compacting and compiling after each
one to ensure things are still okay.

Something else you could try with the suspect objects is to save them as
text, and then import them from the text file. For example, to save Form1
from the corrupted database:
SaveAsText acForm, "Form1", "C:\form1.txt"
Then in the new database:
LoadFromText acForm, "Form1", "C:\form1.txt"

That process should give you a database where the name-autocorrect errors
are gone, the indexes are repaired, inconsistencies between the text- and
compiled-versions of the code are fixed, the reference ambiguities are
resolved, and know each step is okay before moving on to the next one.
 
Thanks Allen,

When I Updated to the latest service pack and rebuilt the database the
problem went away.

It really is a lot of work when you have many clients with databases in all
versions from 97 to 2003. It would be nice if I could get them all to
upgrade but they won't.

Thanks again.

Margaret
 
That's good news.

Yes, the service packs are really crucial. What we do is to display the
version of msaccess.exe and the version of JET on whatever screen you use
for Help | About this program. Then when you get a support call, you can
easily see if the client has their system up to date.

The Control Source for the two text boxes is:
=fGetProductVersion(SysCmd(9) & "msaccess.exe")
=fGetProductVersion(fReturnSysDir() & "\msjet40.dll")
and grab the functions from:
http://www.mvps.org/access/api/api0065.htm
http://www.mvps.org/access/api/api0010.htm

For A97, you need to refer to msjet35.dll.

Hope that helps you to determine if your clients are up to date.
 
Back
Top