This is a strange behaviour that sometimes resets when the whole computer is shut down and restarted - but sometimes not. It does not reset when the database is closed and restarted.

I have a simple VBA code on a button, to open a simple form in which the user enters the date, and selects submit. The code works. Except when it does not.

So my staff member clicked the button. Error warning pops up saying, File not found. When you try to close the button it warns that the debug process will also be closed. It didn't give the option of starting the debug process even though it does open the VBA code. If you try again, Access 2016 crashes. So start Access again, and try again. Same problem. Can repeat it many times.

So instead, after opening the database program, I did a Ctrl-G to open the code. I went to the code for that button, and pressed the <F9> to do a step by step through the code so as to find where the problem is. But it did a step by step all the way through. I closed the code window and the form now opened, went back to the menu and clicked the button to run the code and now it works. This has happened more than once before.

So 3 questions... though the last one matters most.
1. What? Why does it work step by step when failing to work on execution?
2. Why does the step by step somehow fix the problem?
3. Is there a way for me to apply a fix at run time? I can code the OnError trigger to send the code to do something that in effect would do what the step by step is doing without having to stop and actually do so manually. But what would that code say or do?

Sorry... am so confused.

Gary