With Compile on Demand enabled, the compiler is optimized for performance in two key ways: 1) It will only compile code on the current execution path. 2) It will preserve previously compiled code. As I understand it, this can lead to crashes because you might edit the signature of procedure, but modules with code that consume that procedure may not be recompiled.
If you turn those compiler settings off, the entire project is always entirely recompiled before execution. I find I get way fewer crashes with Compile on Demand turned off.
I can think of four places I lose edits: 1) Access crashes with unsaved edits in the IDE. 2) A form opened with the acDialog switch (possibly also true of a form that is opened as Modal). If you edit code in such a form and you explicitly save your edits they will be saved, but if you close this form, or it crashes, unsaved edits are lost without prompts to save. 3) Edits to code in a non-default instance of a form, same as 2). Explicitly saved edits are saved, otherwise everything is lost without prompts. 4) Edits to code in a referenced MS Access Library file. This one it a pain, because these edits are only lost (without warning) after you close the application, so if your library raises an error, breaks into the debugger, you see the error, fix it, but don't realize you were in the library. This edit continues to work correctly for the duration of the current session, but next time you open the app, you get the same error you know you already fixed. For this you must close the current application, and open the Library exclusively, make your edits, close the library, and re-open the app.
Oh, and one more, close a form that initiated execution into a bunch of class modules. The form calls a procedure in another class, which may call into a bunch of other classes. Execution breaks on error or breakpoint, you do some work, edits, comments, tidy up, phone rings, whatever, you close the form, and continue execution in the class. Access crashes when execution returns to the closed form, still present in the call stack, but closed.
Also, Happy New Year all!
Cheers,