Guys & Gals, This is something I have forgotten how to do and was wondering if someone could put me out of my misery! [:p] From a new form with no SourceTable attached to it, I have a control (SourceExpr = ObjID) which looks up the Objects form (F358), and I wish it to populate my ObjID with the record selected via the Objects form. However it’s no returning anything? [?] CLEAR (frmObjects); Object.setrange(Type, objType); frmObjects.LOOKUPMODE (TRUE); frmObjects.SETTABLEVIEW(Object); frmObjects.SETRECORD(Object); frmObjects.RUNMODAL This lookup code is working it’s just not returning the result. Please help. [:)]
IF FORM.RUNMODAL(FORM::“Required Form”,FilteredDataSet) = ACTION::LookupOK THEN “Field” := FilteredDataSet.“Field”; Is this what you are after?
Andrew, Not quite. Let me explain a little more; I have created a new form with 2 global variables objType and objID associated with 2 controls on the form. These 2 controls are to reflect the fields Type & ID of the Object table. objType is an option type variable and has the following options; Table,Form,Report,Dataport,Codeunit. objID has the following code on it’s Lookup trigger (of the control); CLEAR (frmObjects); Object.setrange(Type, objType); frmObjects.LOOKUPMODE (TRUE); frmObjects.SETTABLEVIEW(Object); frmObjects.SETRECORD(Object); frmObjects.RUNMODAL At the moment when I click on the lookup, it runs Form 358 (Objects) and is filtered correctly (depending on the objType). However, what isn’t happening is when double-clicking or pressing the OK button, the objID is not being filled-in by the record selected on the Objects form?!?!? [?] Hope this is clearer.
Andrew, Thanks for your help - your example did help. [:D]
CLEAR (frmObjects); Object.setrange(Type, objType); frmObjects.LOOKUPMODE (TRUE); frmObjects.SETTABLEVIEW(Object); frmObjects.SETRECORD(Object); IF FORM.RUNMODAL(FORM::Objects,Object) = ACTION::LookupOK THEN ObjID := Object.ID; It Should work i Think!!!
Oh you already know! Ha
What about … CLEAR (frmObjects); Object.setrange(Type, objType); frmObjects.LOOKUPMODE (TRUE); frmObjects.SETTABLEVIEW(Object); frmObjects.SETRECORD(Object); if frmObjects.RUNMODAL = Action::LookUpOK THEN BEGIN __frmObjects.GETRECORD(Object); __ObjID := Object.ID; END; ? Regards, Frank