currentForm! applys to the currently opened Form, whereas FieldName must comply to the name of a component in the Form.
When executing or updating the TableElement, wich contains the statement, the field with the specified name will be picked out and the value will be replaced by the value of the copmponent.
| Numbers: | ||
|---|---|---|
| Field in Form | Name = txt_id | Text = 30 |
| Statement | SELECT * FROM MY_TABLE WHERE ID = currentForm!txt_id | |
| Execution | SELECT * FROM MY_TABLE WHERE ID = 30 | |
When special limiters, e.g. simple quotation marks at text values, they must be given as followed.
| Text: | ||
|---|---|---|
| Field in Form | Name = txt_text | Text = Hello World |
| Wrong: | ||
| Statement | SELECT * FROM MY_TABLE WHERE VALUE = currentForm!txt_text | |
| Execution | SELECT * FROM MY_TABLE WHERE VALUE = Hello World | |
| Right: | ||
| Statement | SELECT * FROM MY_TABLE WHERE VALUE = ‘currentForm!txt_text’ | |
| Execution | SELECT * FROM MY_TABLE WHERE VALUE = ‘Hello World’ | |
The execution of the upper statement will cause to an error, because the database will interpret Hello World as a numeric value.
When executing a report from a form, it is possible to access the form with currentForm! by a SQL Statement wich is deposed in the report. By this, previuoisly entered data, wich is not saved in the database, can be displayed on the report.