My form has some simple validation in the Before Update event. If the validation fails the code ends with
DoCmd.CancelEve nt
The form also has an Update command button. This simply runs
Me.Refresh
When the button is clicked, Me.Refresh triggers the Before Update code. If the validation fails and DoCmd.CancelEve nt is executed, I get Error 2001 "You cancelled the previous operation" on the Me.Refresh statement.
The solution which I am reluctant to adopt is to repeat the validation code into the code for the Update command button. This means that the validation will be done twice - on the Update command button and Before Update for the form.
Is there an alternative to Me.Refresh?
Is there an alternative to DoCmd.CancelEve nt?
DoCmd.CancelEve nt
The form also has an Update command button. This simply runs
Me.Refresh
When the button is clicked, Me.Refresh triggers the Before Update code. If the validation fails and DoCmd.CancelEve nt is executed, I get Error 2001 "You cancelled the previous operation" on the Me.Refresh statement.
The solution which I am reluctant to adopt is to repeat the validation code into the code for the Update command button. This means that the validation will be done twice - on the Update command button and Before Update for the form.
Is there an alternative to Me.Refresh?
Is there an alternative to DoCmd.CancelEve nt?
Comment