On the Card form, change the default menuitem that is triggered when pressing F5. In the default this will say LookupTable, but change that to Runobject and link it to the form that you would like to open.
when I do that I get a list that does not have the lookup buttons OK/cancel. Not able to choose a new record, and if I try to add code, it thinks I'm trying to rename the record rather than getting a new record. hmm I'm going to test some more with using setfilter instead of rec.get
table.SETRANGE(..);
form.SETTABLEVIEW(table);
form.LOOKUPMODE(TRUE);
IF form.RUNMODAL = Action::LookupOK THEN BEGIN
form.GETRECORD(table);
Rec := Table;
END;
Table will be a local variable of the same table from the card form.
Form will be the lookup form that you would like to use.
I did a variant where the card is a sales line, and wanted the lookup form to show headers.
instead of rec := table, used rec.setrange on primary keys.
the code works in a menuitem, but not from a onlookuptrigger (which I wanted) but that was solved by using sendkeys.
so now I have F6 lookups that work just like F5 \:D/
Comments
Remco van de Ven
table.SETRANGE(..);
form.SETTABLEVIEW(table);
form.LOOKUPMODE(TRUE);
IF form.RUNMODAL = Action::LookupOK THEN BEGIN
form.GETRECORD(table);
Rec := Table;
END;
Table will be a local variable of the same table from the card form.
Form will be the lookup form that you would like to use.
Remco van de Ven
I did a variant where the card is a sales line, and wanted the lookup form to show headers.
instead of rec := table, used rec.setrange on primary keys.
the code works in a menuitem, but not from a onlookuptrigger (which I wanted) but that was solved by using sendkeys.
so now I have F6 lookups that work just like F5 \:D/
THANK YOU !!! :thumbsup: