View Single Post
Old 11-22-2019, 01:40 PM   #11
Mark_
Longboard on the internet
 
Join Date: Sep 2017
Location: Not the middle of no where, but I can see the road to it from my house.
Posts: 2,112
Thanks: 20
Thanked 405 Times in 396 Posts
Mark_ will become famous soon enough Mark_ will become famous soon enough
Re: Closing a Form after Validation

What I would do, personally, is have your "ValidationOfControl" return a value that is used by both BeforeUpdate AND your CloseButton.

For BeforeUpdate you wind up with something along the lines of
Code:
IF ValidationOfControl() = FALSE THEN Cancel = True
For your button you get
Code:
IF ValidationOfControl() = TRUE THEN DoCmd.Close
In the first, if your validation does not return TRUE then you know to cancel. In the second, if your validation does return TRUE then you know to close the form.
Mark_ is offline   Reply With Quote
The Following User Says Thank You to Mark_ For This Useful Post:
Weekleyba (11-22-2019)