Nightmare OnLookup Street

Hi, I’m trying to reproduce standard lookup functionality with code, as per the following: IF l_frmGLAccList.RUNMODAL = ACTION::LookupOK THEN BEGIN l_frmGLAccList.GETRECORD(l_recGLAcc); IF TextISSelected THEN VALIDATE(Totaling, l_recGLAcc."No.") ELSE VALIDATE(Totaling, Text + l_recGLAcc."No.") END; What I’m trying to get to is that depending on whether the text in the textbox (where I start my lookup from) is selected, the action either overwrites the existing text (if the text was selected), or inserts the newly looked up value behind the cursor. So, if I have “Value1…” in a textbox and do a lookup to Value2, then my textbox should read “Value1…Value2” ONLY if “Value1…” was not selected (highlighted). If “Value1…” WAS selected, my textbox should overwrite “Value1…” with “Value2”, rather than append it. This is using the OnLookup trigger behind a form, not a table. Incidentally, this trigger returns a boolean, but I have no clue what the return value represents, nor do I seem to have access to it? Any pointers? TIA Andre …Added [ code] … [ /code]

maybe it is easier to switch the ClearOnLookup propertie of the textbox to NO, and let the user work like on the rest of navision, not on the rest of VB?

a/ I have to agree with Rene, and b/ I have to welcome Rene back… long time no see, how are things.

Thanks rth Perhaps I should mention that this is in version 3.60, where standard lookup behaves in aforementioned ways. And since I’m trying to replicate standard functionality, ClearOnLookup doesn’t cut the mustard here.

Hi Andre I have a similar problem, did you manage to find a solution. And I’m also trying to replicate the standard functionality with code within the OnLookup trigger of the RequestOptionsForm on a report. I have ClearOnLookup = No and ValidateTableRelation = No. Financials Ver2.01.

Try play with LookUp form OnCloseForm trigger: Something like: rec2 := Rec; Rec.INIT; field1:='BLA..'+rec2.field1; But highlighting is still challenge :confused: