Global var set from subform does not keep its value

greys
greys Member Posts: 29
Hi!

I have a form (frmHEADER. based on table HEADER) with a subform (frmLINES, based on table LINES). On the subform there's a column with a field (NUMBER). The table is used on various forms and I generally want the onvalidate of the field NUMBER to be triggered, but there's one form on which I want some parts of this onvalidate to be skipped.

So I did the following:
- I created a global boolean (BlnSkipValidation) in table LINES;
- I created a function (SetSkipValidation) in table LINES that sets this boolean to TRUE;
- I edited the Onvalidate-trigger of the field NUMBER in the table LINES to make the code depending on the value of the boolean
( IF BlnSkipValidation then EXIT);
- I added the code SetSkipValidation() to the OnOpenForm-trigger of subform frmLINES.

The problem is that the value of BlnSkipValidation is not kept... It is set to TRUE on the moment the subform opens, but when I enter a number in the field NUMBER the value of BlnSkipValidation has again been set to FALSE... I moved the call of the SetSkipValidation() function to the OnAftergetrecord of form frmLines, but that didn't help.

Am I missing something or is there a better way to achieve this?

Thanks in advance

JGreys



EDIT: I solved it by taking the code out of the onvalidate-trigger of the table and putting it in the onvalidate of the form control. That works.