Hello
yes I understand what you mean.
My example is about entering a value in some field.
When opening some forms- here I use some events on forms load event and current event so with this I am preventing possible errors?
There is an old saying that I don't hear very often any more: An ounce of prevention is worth a pound of cure. Perhaps I've outlived those who used to say it? More likely it has been replaced. See later discussion.
While error handler routines are not
always hard to code, having an error routine that must undo an SQL action can be daunting, particularly if it would have been possible to prevent the erroneous action with simple tests. If a simple test can prevent a potentially catastrophic recovery effort, why would you NOT make such a test?
We joke a lot about "Murphy's Law" which states "Anything that CAN go wrong WILL go wrong." Nobody ever remembers the last half of the complete quote: "... so make it impossible to go wrong." They forget the quote and the circumstances that led to its original utterance, but we do not forget the principle it espouses. It is this engineering law that brings us shaped connectors that can only be plugged in one way, both with polarized electrical outlets and computer internal connectors with selective bevels or other odd shapes. When Ed Murphy uttered his famous law, software was still in its infancy, but the law echoes throughout our work even today.
In case anyone has forgotten, Ed Murphy was a real person, an engineer at White Sands, New Mexico, USA during some of NASA's early testing of rocket sleds and human endurance. He said those famous words at the meeting after a test in which a human subject suffered a 9-G pullout but the data plugs were backwards - so the test got NO DATA. Those words inspired everyone to look for ways to make things foolproof.
Humans, being even more devilishly ingenious than even Ed Murphy thought, have found ways to defeat "foolproof" precautions, but at least we've thinned the herd of fools in dangerous settings. (Idle thought: Does this mean that we are evolving better fools by culling the herd of the lesser fools?)