Selecting only the first record from lookup

Hello Everyone,

How could i select only the first record only from a lookup whereas cant access the other records but can view it?

Suppose having 4 lines on the lookup but able to select the first one only.

Thanks in Advance

please describe in more detail what you need.

it’s not clear what you want.

How do you sort the selected/filter records ?

Does User can able to change sorting method by selecting others key (if exist) ?

Try it:

Form/Page - OnQueryCloseForm() : Boolean

Record.SETCURRENTKEY(Field1, [Field2],...)
   RecordVar2 :=Record.

I am having a lookup field(table relation )in a subform. Now i have multiple lines there. I want that the user can only able to select the first line from that lookup not the other lines.

How could i do so??

Thanks all


is there any line number for subForm? If exist, in that case it is possible…

yes, its having line no…So do i need to close the lookup from property & write it through code?

But how to catch only the first line ?

to get only the first record redefine the filter criteria, so that you only get one line as lookup result, add e.g. line no. = 10000.

for writing lookup code follow

use rec.findfirst to get only the first record of a filtered result or use get function.


you can set a filter on the table relation to select only the first line. Go to the table option/Table relation/set the filter between the source table and the destination table based on the line number.

:slight_smile: Have fun coding


is your question answered ?

yes, thank you all

please verify the answers, which helped you to find a solution. thx.

In on lookup trigger…

after setrange the by the common field the findfirst has worked for me.

IF PAGE.RUNMODAL(50087,pagename)=ACTION::LookupOK THEN



record.SETRANGE(HpLedger.“Proposal No”,“Proposal No.”);

record.SETRANGE(HpLedger.“I.C No”,“Customer Nos.”);

record.SETRANgE(HpLedger.“Payment Status”,FALSE);


“Line No”:=record.“Entry No”;

“Installment Amount”:= record.“Due Amount”;

“Due Date”:= record.“Due Date”;