Mandatory fields

Before closing a form I want to check if some fields are filled. I know I have to do this in the OnQueryCloseForm trigger. I open the form by the statement: IF f.RUNMODAL = ACTION::LookUpOK then … When I push the LookUpOK button it doesn’t read the OnQueryCloseForm trigger. I want the user to stay in the form when some fields are not filled. A solution please.[:)]

One of the solutions is to make form not editable when you open it as lookup. On OnOpen form trigger write statment: CurrForm.EDITABLE(NOT CurrForm.LOOKUPMODE);

I’m not sure to fully understand what you want to accomplish. Usually, a lookupform is used to select a record in another table, to populate a field in the actual table. If the field in a table should always be populated, you should use the function TESTFIELD in the table OnInsert and OnModify trigger. This will avoid having a blank value in your field and will be triggered before you leave the record.

Search the forum for “mandatory fields” and you will find a nice solution (mine ;->)

I did a thing like that a few years back - And recently I have done a little thing, that might be similar. On our Item Card Form I have added the following Code: **Form - OnFindRecord(Which : Text[1024] : Boolean** //>> 021 GNR/HH Item.COPY(Rec); IF NOT Item.FIND(Which) THEN EXIT(FALSE); Rec := Item; EXIT(TRUE); //<< 021 GNR/HH **Form - OnNextRecord(Steps : Integer) : Integer** //>> 021 GNR/HH Item.COPY(Rec); CurrentSteps := Item.NEXT(Steps); IF SKUMgt.WasFieldsModified THEN <- Our own codeunit CurrentSteps := 0; IF CurrentSteps <> 0 THEN Rec := Item; EXIT(CurrentSteps); //<< 021 GNR/HH Basicly what this accomplish, is to tell the user if a field was changed, for a item that also have SKU’s - If this is the case, the Item card stays on the same record. This is also very usefull, if you test for mandatory fields - You want to stay on the same Item, so they do not chage the next record.