Taking value from lookup form

Hi,

I’ve got a form - Seminar Form with fields “Seminar Code”, “Seminar Name”… etc. I wanted to do LookUp on SeminarCode to take values from Seminar table. I’ve tried two ways:

IF(FORM.RUNMODAL(0,Seminar) = ACTION::LookupOK) THEN BEGIN

“Seminar Code” := Seminar.Code;

MESSAGE(“Seminar Code”);

END;

and

CLEAR(SeminarForm);

SeminarForm.LOOKUPMODE(TRUE);

Seminar.SETRANGE(Blocked,FALSE);

IF SeminarForm.RUNMODAL = ACTION::LookupOK THEN BEGIN

SeminarForm.GETRECORD(Seminar);

“Seminar Code” := Seminar.Code;

MESSAGE(“Seminar Code”);

END;

In both cases a proper message appears, but after that value “Seminar Code” in my Seminar Form does not change.

I’ve to ‘override’ OnLookup() because I’ll need to do additional things with this “Seminar Code” next.

What can I do to make it work?

Hi,

Welcome to the Dynamics User Group!

The first code will not work. The second set of code looks correct but the filter set on the Seminar variable may be the problem. To see the form filtered with this record use

SeminarForm.SETTABLEVIEW(Seminar);

before the RUNMODAL command.

What’s wrong with the first piece of code?

As far as I understand the problem description the lookup is not the problem but the update of the form. From what I can see here that should work.

Hi Thomas,

You are correct, the first option also work - my mistake. [:$]

Hi MM!

Try:

CurrForm.UPDATE;

Ari