Thursday, March 12, 2009

Ab-normalization at Experts Exchange - part 3

The question today:
How to trap error when form closes with a null value in an index or primary key field?

Obviously this member tries to close a partially filled for, or a so-called "dirty" form.
The "normalized" way to handle this is to issue a confirmation message that the user wants to abandon the record and when confirmed, issue a "Me.Undo" to restore the record contents and to close the form normally.

The Experts-Exchange #1 Access expert however proposes to code an error handling exit when dataerr=3058 occurs in the form_error event.
This will however work sometimes, but as the error code can differ, depending on the Access and Windows version, it's no 100% solution.
Moreover in general coding rules it's considered bad practice to code error handling afterwards when you can intercept / prevent such an error on forehand.

Nic;o)
Still proud to be suspended from this "quality site" where wannabee experts rule and "quality" is just another word from the dictionary.
(The question can be found at: http://www.experts-exchange.com/Q_23924143.html)

No comments:

Post a Comment