Some forms and pages in Dynamics NAV are used both for setup and look up. For example form and page “Payment Terms” with ID 4. I like to add a code to forms and pages to prevent this.
CurrForm.EDITABLE := NOT CurrForm.LOOKUPMODE;
CurrPage.EDITABLE := NOT CurrPage.LOOKUPMODE;
This causes the form or page to be write protected if they are opened as a look up from the “Payment Terms Code” fields.