By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,790 Members | 1,409 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,790 IT Pros & Developers. It's quick & easy.

Close a form before it opens

P: n/a
I have a situation where on the forms load I ask for some date
information. If the user decides to cancle out of entering a date, I
want the form NOT to open.

How would I do this. The VBA code is in the forms load procedure.

Michael Charney

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
pap
....move the code to a module and ask the question before opening the form.

--

peter walker

"Michael Charney" <mb*******@sbcglobal.net> wrote in message
news:3f*********************@news.frii.net...
I have a situation where on the forms load I ask for some date
information. If the user decides to cancle out of entering a date, I
want the form NOT to open.

How would I do this. The VBA code is in the forms load procedure.

Michael Charney

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2

P: n/a
You can't cancel the open in the OnLoad event, you can cancel it in the OnOpen event.

--
Wayne Morgan
"Michael Charney" <mb*******@sbcglobal.net> wrote in message
news:3f*********************@news.frii.net...
I have a situation where on the forms load I ask for some date
information. If the user decides to cancle out of entering a date, I
want the form NOT to open.

How would I do this. The VBA code is in the forms load procedure.

Michael Charney

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #3

P: n/a
tom
> You can't cancel the open in the OnLoad event, you can cancel it
in the OnOpen event.


However, you can do a "docmd.close" in the Load event, and that will
close the form. (I've found form_Open to be unreliable at times, so I
stick with form_Load when possible. Also, using the Cancel ability of
form_Open sends an error back to the code that opened the form.)

-td
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.