Form functions operate like global user-defined functions, except they are associated with a specific form. Form functions are used to provide functionality that is specific to a form.
To create a form function for a specific form, open the Form Definition window for the form. Click the Scripts tab and choose Functions as the type of script to display. Click New to create a new function or select an existing function and click Open. The script editor will appear, allowing you to edit the function script.
To call a form function from a script that is part of the same form, simply use the function in the script. If you’re calling a form function from a script that isn’t part of the form, you must qualify the function by including the form name immediately after the function. For example, the CalculateMonthlyPayment() function is part of the Calculate_Payments form. To use this function in a script that isn’t part of the Calculate_Payments form, you must qualify the function with the form name:
payment = CalculateMonthlyPayment(price, interest) of form Calculate_Payments;