Cancelling Form Open Event

highandwild

Registered User.
Local time
Today, 13:29
Joined
Oct 30, 2009
Messages
435
I need to close a form after checking a condition in the Form_Open event.

I expected that by setting Cancel = True that the form will close but this does not happen.

DoCmd.Close also does not close the form.

Any ideas anybody?

Thanks
 
I've never had an issue with this.

Post the code in your form open event.
 
What, exactly, are you trying to check? The Form_Open event is too early for doing many things.

Linq :0)>
 
Well, if the code doesn’t run it won’t work.

Is the database in a trusted location?
Does the event procedure have error handling which might bypass the code on error?

If you want to close the Form then close it; but is it necessary to set Cancel = True?

Chris.
 
Chris makes a good point! In version 2007 and later, for VBA code to execute, the folder holding the database needs to be in a Trusted' location.

To "Trust" your folder, click:
  • Office Button (top left)
  • Access Options (bottom of dialog)
  • Trust Center (left)
  • Trust Center Settings (button)
  • Trusted Locations (left)
  • Add new location (button)
Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom