I am creating a new database. I put a button on the form with the code:
docmd.quit
When I view this code in the code window, put my mouse in that function and press F5 I get the macro window pop up. It doesn't execute the function. Any idea why?
Why would I think it would do anything? Cause it is suppose too. It always has in the past.
If I have the following code on a form and in a module:
Private Sub QuitThisDatabase()
DoCmd.Quit
End Sub
pressing F5 in the module (with the cursor within the sub) will cause the application to quit. If I put the cursor in the same place in the code on the form and press F5 the box pops up asking me which macro I want to run.
This has never happened before. It has always ran the sub and performed whatever action it was programed to do (in this case quit the application) or given me an error letting me know there was something written wrong in the code.
I am trying to figure out why this has stopped functioning the way it always has in the past.
As I clearly stated it never stopped functioning. It only functioned when calling from a standard module, it never works when calling from a class module such as a form's, report's, or other class module. This is logical and expected behavior.
I guess we will just agree to disagree because what I am trying to do did work at one time. I am not the only one that has noticed the difficulty in trying to debug the form's code. Oh well...I will find the answer.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.