IF "Buy-from Vendor No."='' THEN BEGIN ERROR('Error:Empty field'+FIELDCAPTION("Buy-from Vendor No.")+'Please Add Data in field.'); END; IF "Buy-from Vendor Name"='' THEN BEGIN ERROR('Error:Empty field '+FIELDCAPTION("Buy-from Vendor Name")+'Please Add Data in field.'); END; IF "Buy-from Contact No."='' THEN BEGIN ERROR('Error:Empty field '+FIELDCAPTION("Buy-from Contact No.")+'Please Add Data in field.'); END; IF "Buy-from City"='' THEN BEGIN ERROR('Error:Empty field '+FIELDCAPTION("Buy-from City")+'Please Insert Data in field.'); END; IF Structure='' THEN BEGIN ERROR('Error:Empty field '+FIELDCAPTION(Structure)+'Please Insert Data in field.'); END; IF "PO Type"="PO Type"::" " THEN BEGIN ERROR('Error:Empty field '+FIELDCAPTION("PO Type")+'Please Insert Data in field.'); END;for line level of Purchase order code like this
[code]RecPurchLine.RESET; RecPurchLine.SETRANGE(RecPurchLine."Document No.","No."); //RecPurcaseLinehLine.SETRANGE(RecPurchLine."Document Type","Document Type"); IF RecPurcaseLine.FIND('-') THEN BEGIN //REPEAT IF RecPurchLine.Type=RecPurchLine.Type::" " THEN BEGIN MESSAGE('Error:Empty field Type Please Insert Data in field.'); END; IF RecPurchLine."No."='' THEN BEGIN MESSAGE('Error:Empty field '+FIELDCAPTION("No.")+'Please Insert Data in field.'); END; //UNTIL RecPurcaseLine.NEXT=0; END;but even if field having value then also massage pop up and repeat infinite times as we close that massage
Answers
where have you placed the code from the original post? In codeunit 90? I think the reason you get the messages, even though the fields are filled, is because the rec where you have put your code is not the purchase document, but the posted document, which is being created.
If you setup an event as following:
Then you will have the Purchase Header Rec as VAR, and you can find the attatched lines.