Error with button doesn't trigger OnError

wjoc1

Registered User.
Local time
Today, 07:58
Joined
Jul 25, 2002
Messages
117
Hi,

I have a form with a button which allows the user to save the record using
Code:
DoCmd.RunCommand acCmdSaveRecord

This will generate a standard Access error (run-time error 3314) message if the user tries to save the record with required fields missing.

I wanted to pick this up in the Forms OnError event and display my own custom message but when this error is generated it doesn't trigger this event.

Why not!?
 
Trap it in the button rather than the form.
 
I can trap it in the button ok but I just really wanted to trap it on the form. I'm using the forms OnError event to trap one or two other such errors and I just wanted to catch them all in the one place.

Why doesn't this error trigger the forms OnError event?
 
BeforeUpdate

Try trapping it with the Form_BeforeUpdate event. That way even if they save it the 'normal' way (moving to a different record, closing the form, etc) they'll still get your customized message.
 

Users who are viewing this thread

Back
Top Bottom