Validation rule for table - custom error message not displayed

Validation rule for table - custom error message not displayed

Post by zyzolu » Mon, 08 Dec 2008 22:06:56


Hello,
I created a validation rule for table:
([StartDate] <= [EndDate])
"Custom error message"

1) If I try to save "manully" (shift+enter) a record which violates
the rule my custom error message is displayed and the record is not
saved - that is correct.

2) If enter data which violates the rule and click "Close" button on
the form (VBA code assigned: DoCmd.Close), the form closes but no
custom error message is displayed (and record is not saved).

Why isn't the custom error message displayed in case "2)" ?

Thank you for hints.

Access 2003
OS: Win XP
 
 
 

Validation rule for table - custom error message not displayed

Post by Allen Brow » Mon, 08 Dec 2008 23:29:03

This is a bug that's been in Access forever.

Details in:
Losing data when you close a form
at:
http://www.yqcomputer.com/

As the article explains, the workaround (once you are aware of the problem)
is to explicitly save before closing.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://www.yqcomputer.com/
Reply to group, rather than allenbrowne at mvps dot org.

 
 
 

Validation rule for table - custom error message not displayed

Post by zyzolu » Mon, 08 Dec 2008 23:55:22

Thank you for prompt reply.