Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The VBA project in your front end is likely corrupted. You need to rebuild it from scratch and then use proper Access coding practices:</p> <ol> <li><p>in VBE options, turn off COMPILE ON DEMAND (see <a href="http://trigeminal.com/usenet/usenet004.asp?1033" rel="noreferrer">Michael Kaplan's article on DECOMPILE</a> for details of why).</p></li> <li><p>in VBE options, turn on REQUIRE VARIABLE DECLARATION.</p></li> <li><p>in the VBE, customize your toolbar so that the COMPILE button is easily accessible (it's on the Debug menu). I also recommend adding the CALL STACK button (from the VIEW menu), as it's handy for debugging errors in break mode. The point here is to make debugging and compiling as easy as possible.</p></li> <li><p>having set up your environment, go through all the modules in your newly recovered project and add OPTION EXPLICIT to the top of every module that lacks it. Then compile. You'll quickly find out where you have invalid code and you'll need to fix it.</p></li> <li><p>from now on, when programming, compile frequently, after every two or three lines of code. I probably compile my project 100 or more times a day when coding.</p></li> <li><p>periodically decompile your project and compact and recompile it. This will clean out any crud that accumulates during regular development.</p></li> </ol> <p>These practices insure that the code in a non-corrupt project stays in as clean a condition as possible. It will do nothing to recover an already corrupted project.</p> <p>In regard to how to rebuild the project, I think I'd go the drastic route of exporting all the objects with Application.SaveAsText and importing them into a new blank database with Application.LoadFromText. This is superior to simply importing from your existing corrupted front end because the import can import corrupt structures that won't survive a SaveAsText/LoadFromText cycle.</p> <p>I program daily in Access, working with non-trivial apps that use lots of code, including plenty of standalone class modules. I have not lost an object to code corruption in over 5 years, and that was back in the day when I was still using A97.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload