KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Assigning a value to a field in a new record in Subform
PRODUCT: 4D | VERSION: | PLATFORM:
Published On: April 2, 1999
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

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: