To use the /decompile command to help troubleshoot a problematic mdb file (for example, if you have a specific form that is causing problems and gives you errors that you're sure are not relating to code):



Click Start -> run (or create a shortcut with the below parameters or create a *.bat or *.vbs file to execute)

and then type in: "C:\Program Files\Microsoft Office\Office10\MSAccess.exe " "C:\MyFolderName\MyMDBName.mdb" /decompile

Of course change the above folders/names to where your MSAccess.exe file and mdb is located.

Using the /decompile option, you could then identify and delete/re-create or re-import a problematic form or troubleshoot other problems. (as a note: if you have multiple MSAccess versions on your computer, and you import a form from one *.mdb into another, if you don't 'immediately' debug/compile after importing the form and instead start writing some code, you'll most likely corrupt the form. This is a noted problem on Microsoft's website where they recommend only using 1 version of MSAccess on a computer.)

Some Microsoft links:
http://support.microsoft.com/kb/279334/en-us
http://support.microsoft.com/kb/870961
http://support.microsoft.com/kb/218861
http://support.microsoft.com/kb/290576
http://support.microsoft.com/kb/283849
http://support.microsoft.com/kb/299373/en-us
http://support.microsoft.com/kb/247771/en-us
http://support.microsoft.com/kb/209137/en-us



Make sure to then also Compact/Repair your MSAccess file. (Tools -> Database Utilities -> Compact and Repair Database) (this may be in a different location for 2007 and 2010.)

You'll also want to edit the code (Ctrl-G) to get to the immediate window for coding. Then select Debug -> Compile MyAppName.

Additionally, you can check the References by selecting (in the immediate windows), Tools -> References. If a particular reference is "missing", this can affect other references and will most likely cause issues with your expressions/code. An example would be if you get an error when using an expression such as: Format(Date(),"mm/dd/yyyy") and the error says that it doesn't recognize "Format" or "Date". This is usually a sign of a bad or missing reference.

Note: you cannot create an *.mde or *.accde file if there are coding errors. You should always Debug/Compile before creating any *.mde/*.accde file to see if you have any errors in the code.

* and don't forget to make backups of your *.mdb/*.accdb file!! (and do this often! I do it every time before I get in to make any coding changes.) For the 5-10 seconds it takes to 'Copy/Paste', it can save you hours and hours or days and days of trying to salvage a corrupt *.mdb/*.accdb.