Automatically set default for field of type 'Option'

For the Credit Memo and Invoice forms we want to set the ‘Type’ option on the associated sub-form to automatically default to ‘Account (G/L)’ without user intervention. Although re-ordering the selection list in the textbox properties has worked in some cases, it doesn’t work everywhere. I’ve also ensured that all properties (i.e. Focusable, Editable, etc.) match between the working and non-working forms, but it doesn’t seem to matter. The ‘Type’ field will be removed from user view when I’m satisfied the default sets to Account (G/L) on a reliable basis. Solutions, anyone?

In Form 96, OnNewRecord replace the existing Type := xRec.Type; with Type := Type::“Account (G/L)”; That’s it. Marcus Marcus Fabian phone: +41 79 4397872

Thanks for the reply, Marcus. After looking at your code, the example you gave makes sense. However after implementing it, the system will not let me move out of the input line after attempting to enter the amount. I suspect that whatever mechanism was preventing my method from setting the default value is also hindering the code. I’m at a loss…

Just an update: I removed the ‘Type’ textbox from the subform, then readded it from the View/Field menu. After running the main credit memo form, I deleted the line entry I had attempted earlier. Now the default seems to be working appropriately. Thanks, again!

Reordering fields of type option can be a dangerous thing to do as the code that surround them will change, and any existing data will be somewhat confused. Its definitely possible on a new database but Id recommend leaving them alone when working on an existing database - or only adding to them Craig Bradney Project Manager - Technical Navision Solutions & Services Deloitte Growth Solutions Deloitte Touche Tohmatsu P:+61-2-9322-7796 F:+61-2-9322-7502

I think you should set the ‘Init value’ in the table. That will do the trick