I have a whole bunch of VB code in the OnValidate routine for a field.
This code captures data entry errors and displays messages to the
user. That's fine, but now i realize the user can still attempt to
save the form anyway if they don't change the value (since the
OnValidate is only triggered when a change is made). At that point
they would get the standard InfoPath error message which indicate a
field has a validation error, which is sure to confuse the users.
I could copy all the validation code into the Submit button routine,
but that's pretty ugly. i guess i could create a module with the code
and call it from OnValidate and Submit. Still seems wrong.
There must be a "normal" way of handling this situation (obviously i
don't do this everyday). Any suggestions?
thanks
Greg Collins - 22 Feb 2008 20:46 GMT
What I've often done is to have the submit function just check to see if
there are *any* validation errors (using the Errors collection) and if so,
give a generic message to go handle those, and cancel out. If no errors,
then proceed with the submit.

Signature
Greg Collins
Microsoft MVP
Visit Braintrove at http://www.braintrove.com
Visit InfoPathDev at http://www.infopathdev.com