Log In    |    Knowledge Base    |    4D Home
Tech Tip: Assigning a value to a field in a new record in Subform
Published On: April 2, 1999

When a new record is created in a subform there is no On Load event to assign values to fields before they are displayed. There are two workarounds for this limit.
The first way is to put some code in the Form Method of the subform that tests to see if the field does not have a value. For example:

The 2nd workaround is to put the code into the Trigger. To limit when the code will be executed, turn only the On Save New Record trigger on or use the Database Event function. For example: