Options

PLEASE SEE, lookup return Cancel

cpinacpina Member Posts: 52
edited 2004-12-22 in Navision Financials
CLEAR(fInvProyecto);
recInvProyecto.SETFILTER("Cod. Recurso",cRecurso);
fInvProyecto.LOOKUPMODE(TRUE);
fInvProyecto.SETTABLEVIEW(recInvProyecto);
IF fInvProyecto.RUNMODAL <> ACTION::lookupOK THEN BEGIN
MESSAGE('1');
EXIT(FALSE);
END;
fInvProyecto.GETRECORD(recInvProyecto);
xProyecto := recInvProyecto."Nº proyecto";
EXIT(TRUE);

the runmodal returns always "Cancel" something diferent to lookupOK, the form properties seem to be correct, but I do not if I have forgoten some property


Your ideas are welcome.

Comments

  • Options
    g_dreyerg_dreyer Member Posts: 123
    Hi CPina,

    On the form properties (the one that you do your lookup to), has the following
    Property:LookupMode (If you choose No, the system automatically disables the LookupOK and LookupCancel actions.)

    Have a look at the PushButton (your OK button on the form as well)
    Property: PushAction
    To have the system perform this action... Choose...
    Close form and return OK: OK 
    Close form, do not return OK: Cancel 
    Close lookup form and return OK: LookupOK 
    Close lookup form, do not return OK: LookupCancel 
    Close form and return Yes: Yes 
    Close form and return No: No 
    Close the form: Close 
    Stop processing: Stop 
    

    If you want to find out what message get's returned then,
    MESSAGE(format(fInvProyecto.RUNMODAL));
    
    or if you are still in doubt, check for both or check for 'cancel'
    IF not(fInvProyecto.RUNMODAL in [ACTION::lookupOK,ACTION::OK)
    THEN BEGIN 
      MESSAGE('1'); 
      EXIT(FALSE); 
    END; 
    

    Please note that I have not tested the above code for any errors, but you should get the idea.

    Cheers,
    gus
  • Options
    eromeineromein Member Posts: 589
    I would like to add this sample... It's an alterative for the code that has been posted.
    IF FORM.RUNMODAL(0,Cust) = ACTION::LookupOK THEN
      MESSAGE(Cust.Name); // Selected record in lookup form
    

    Click this link to download the Navision Bible!
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
Sign In or Register to comment.