To apply scripts to a form, open the form by clicking the Forms button on the toolbar and opening the Form Definition window for the form you want to attach scripts to. In the Form Definition window, click the Scripts tab. Use the Pre Script and Post Script buttons to attach scripts to the form.
Form pre script This script runs just as the form is opened. A form is opened when a window in the form is opened or when the open form statement is executed. Typically, form pre scripts are used to set initial characteristics of windows in the form. The form pre script doesn’t run when a form is restarted.
Form post script This script runs just as the form is closed. A form is closed when the main window for the form is closed, or when the close form statement is executed. Typically, form post scripts are used to set values in other areas of your application based on values entered in the windows of the form.