目录
索引 🔎︎

# Database Form Events

The Events tab page, allows you to assign a macro to certain events which occur in a database form.

要访问此命令...

Open context menu of a selected form element - choose Form Properties - Events tab.

Open Form Design toolbar, click Form Properties icon - Events tab.

要使事件与宏链接，需要先编写宏，将所有要在事件发生时执行的命令都包括在宏中。然后点击事件旁的「...」按钮，以指定相应的宏。将打开「指定宏」对话框，可以在其中选择宏。

以下这些操作可以让用户自由配置，即您可以用自己的对话框显示操作:

1. 显示错误报告,

2. 确认 (数据记录的) 删除操作,

3. 查询参数,

4. 保存数据记录时检查输入。

例如，在删除记录时，可以发出「确定删除」请求，例如「确定要删除客户 xyz 吗？」。

The events that are shown in the Events dialog cannot be edited directly. You can remove an event from the list by pressing the Del key.

下面列出并介绍了表格中可以与宏链接的所有事件:

## 加载时

The When loading event occurs directly after the form has been loaded.

## 发生一个错误

The Error occurred event is activated if an error occurs when accessing the data source. This applies to forms, list boxes and combo boxes.

## 在卸载之前

The Before unloading event occurs before the form is unloaded; that is, separated from its data source.

## 在卸载时

The When unloading event occurs directly after the form has been unloaded; that is, separated from its data source.

## 在重新加载时

The When reloading event occurs directly after the form has been reloaded. The data content has already been refreshed.

## 填入参数

The Fill parameters event occurs when the form to be loaded has parameters that must be filled out. For example, the data source of the form can be the following SQL command:

SELECT * FROM address WHERE name=:name

Here :name is a parameter that must be filled out when loading. The parameter is automatically filled out from the parent form if possible. If the parameter cannot be filled out, this event is called and a linked macro can fill out the parameter. Return True when the execution of the parametrized statement should continue, False otherwise.

## 提交之前

The Before submitting event occurs before the form data is sent. Returning True approves the submission, False stops it.

## 更新之前

The Before update event occurs before the control content changed by the user is written into the data source. The linked macro can, for example, prevent this action by returning FALSE.

## 更新之后

The After update event occurs after the control content changed by the user has been written into the data source.

## 重置之前

The Prior to reset event occurs before a form is reset. Returning True approves the reset, returning False cancels the operation.

如果出现下列条件之一，表格会被重置:

1. 用户确认一个被定义为复位按钮的 (HTML) 按钮。

2. 在链接到数据源的表格中创建新的空白记录。例如，在最后的记录中按下「下一个记录」按钮。

## 重置之后

The After resetting event occurs after a form has been reset.

## 确认删除

The Confirm deletion event occurs as soon as data has been deleted from the form. Return True to allow row deletion, False otherwise. For example, the linked macro can request confirmation in a dialog.

## 记录操作之后

The After record action event occurs directly after the current record has been changed.

## 记录操作前

The Before record action event occurs before the current record or record set are changed. Return True when changing is allowed, otherwise False. For example, the linked macro can request confirmation in a dialog.

## 记录更改前

The Before record change event occurs before the current record pointer - SQL cursor - is changed. Return True when moving is allowed, otherwise False.

## 记录更改后

The After record change event occurs directly after the current record pointer has been changed.

## 重新加载之前

The Before reloading event occurs before the form is reloaded. The data content has not yet been refreshed.

## Vetoable events

Macros can interrupt event execution when they return a boolean value: True allows the execution of the event to continue and False stops the event execution.

The following events are interruptable by returning False:

- Before record action

- Before record change

- Before submitting

- Before update

- Fill parameters