1. Disabled warnings is the most likely culprit when you get no warnings that an object is dirty when you close it.
2. If you change code while it is running, Access doesn't always save immediately. That could be the other part of why you are losing code.
You only have to lose code once or twice maybe to become quite aware that you always "change, save, compile, run" dozens of time during a session.
I created two macros that I use in situations where I want to stop the user from getting warning messages. The macros:
1. Turn warnings off, turn hourglass on
2. Turn warnings on, turn hourglass off
WHY - if you stop the code to debug while the warnings are off, the hourglass will remind you of that so you never forget to save - or run the other macro to turn the warnings back on.