Clarification Required

Hi all, I have some confusion regarding the ERROR Messages. When I write an Error message on sub-form(OnValidate Trigger) level of a form, OnClick of “OK” on error window. The whole form closes and the control comes to Main Menu. If i write the same ERROR in Table Design (OnValidate Trigger), the control doesnt close the form instead it stays on the same control. So i want to know whether its a Bug or the navision works like this. Thanks & Regards, Vikas

I’m willing to bet that’s because you sticked the code in the OnAfterValidate trigger of the control instead of in the OnValidate trigger.

Yea…Your are right!! The current code has been written in OnAfterRecord Trigger but the same code was tested on OnValidate Trigger and it is giving the same error. Please suggest the solution for this. Thanks in advance Vikas

Please post the code and tell us the form.

Vikas, have a look at the online help of each of the different triggers and you will find the following text:

quote:

OnAfterValidate Use this trigger if you want to update the form after the system validates the user’s input. If there is an error in the C/AL code you enter into this trigger, the system closes the form. You can use this trigger to write to the database.

quote:

OnValidate (Fields) If there is an error in the C/AL code you enter into this trigger, the system displays an error message, leaves the user’s entry in the field, but does not write the record to the database.

This means that this behaviour is standard Navision… Saludos Nils