# Nightmare OnLookup Street

**URL:** <https://www.dynamicsuser.net/t/nightmare-onlookup-street/7452>\
**Category:** Developers Forum\
**Created:** [August 11, 2003, 9:45am UTC](https://www.dynamicsuser.net/t/nightmare-onlookup-street/7452 "2003-08-11T09:45:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andre\_n](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@andre\_n](https://www.dynamicsuser.net/u/andre_n)\
**Post date:** [August 11, 2003, 9:45am UTC](https://www.dynamicsuser.net/t/nightmare-onlookup-street/7452/1 "2003-08-11T09:45:10Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![rth](https://avatars.discourse-cdn.com/v4/letter/r/9d8465/32.png) [@rth](https://www.dynamicsuser.net/u/rth)\
**Post date:** [August 11, 2003, 3:22pm UTC](https://www.dynamicsuser.net/t/nightmare-onlookup-street/7452/2 "2003-08-11T15:22:40Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![David\_Singleton](https://sea1.discourse-cdn.com/flex023/user_avatar/www.dynamicsuser.net/david_singleton/32/7471_2.png) [@David\_Singleton](https://www.dynamicsuser.net/u/David_Singleton)\
**Post date:** [August 11, 2003, 10:32pm UTC](https://www.dynamicsuser.net/t/nightmare-onlookup-street/7452/3 "2003-08-11T22:32:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![andre\_n](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@andre\_n](https://www.dynamicsuser.net/u/andre_n)\
**Post date:** [August 12, 2003, 12:11am UTC](https://www.dynamicsuser.net/t/nightmare-onlookup-street/7452/4 "2003-08-12T00:11:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stepheng](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@stepheng](https://www.dynamicsuser.net/u/stepheng)\
**Post date:** [October 2, 2003, 10:53am UTC](https://www.dynamicsuser.net/t/nightmare-onlookup-street/7452/5 "2003-10-02T10:53:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![FormerMember](https://avatars.discourse-cdn.com/v4/letter/f/74df32/32.png) [@FormerMember](https://www.dynamicsuser.net/u/FormerMember)\
**Post date:** [October 3, 2003, 9:10am UTC](https://www.dynamicsuser.net/t/nightmare-onlookup-street/7452/6 "2003-10-03T09:10:29Z")

</div>

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