CurrFieldNo in Form-OnLookup-Trigger is not passed to record

As is well known, the OnValidate- and OnLookup-Trigger in a form’s textbox and the corresponding triggers in the form’s source table work together in a special way, i.e., if there is some code in both OnValidate-Triggers, the form’s trigger is run first, afterwards the table trigger is run. If there is some code in the OnLookup-Triggers, only the form-trigger is run, if there is no code in the form-trigger (and no local variables !), the OnLookup-table trigger is run.

One may now create a new table with one field (“Field No.” = 1, Code10 ore something else) and a corresponding tabular-type form and put in all four field-triggers (table and form) a call to a function, which may be called OnLookupTest. This function has to be created in the new table and consists of one line of code:


To test the code, at first let’s go into the object designer and run the table directly. Anything functions as expected, when pressing F6 in the field or input some value, the message box appears with value 1 (“Field No.” of the field). Now let’s do the same thing with the form. The validate operates quite normal (the message box appears twice !) but the lookup in the form unexpectedly gives ‘0’ (or sometimes another random value) as message!?

This strange behavior may lead to trouble, because for example in the application code of table 37 (sales line) the CurrFieldNo is referred to quite often. Fortunately in the standard application there are not too much form-OnLookup-triggers (if any), but if one has to do some customization, the only workaround is to supply another function “SetCurrFieldNo”, which has to be called from the form-OnLookup-trigger before calling any other table-functions and this is a rather awesome job…

Could anybody reproduce this bug?

By the way, I think this topic should be moved to “Known Issues”…