docmd.close acForm ignored

J

Joe M.

I have a form with a cmd button that has the code
DoCmd.Close acForm, "Hours_Flexible_Query": MsgBox "Stop"
The code is ignored and the form does not close. The msgbox executes. On
another form the identical type code exists and works. Why is this happening?
Can someone help?

Thanks,
Joe M.
 
D

Dirk Goldgar

Joe M. said:
I have a form with a cmd button that has the code
DoCmd.Close acForm, "Hours_Flexible_Query": MsgBox "Stop"
The code is ignored and the form does not close. The msgbox executes. On
another form the identical type code exists and works. Why is this
happening?
Can someone help?


I would double-check the name of the form, and make sure (because of the
name) that you're trying to close a form, not a query. DoCmd.Close won't
throw an error if the object you're trying to close isn't open, so if you
misspell the form name, nothing will happen.
 
J

Joe M.

Unbelievable! I must checked this 3 or 4 times! But that was the problem.
Thanks for the info!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top