以下示例用于当“箱数”字段不包含值时,防止用户保存对当前记录的更改。
Private Sub 箱数_BeforeUpdate(Cancel As Integer) ' 检查箱数字段中的空白值。 If IsNull(Me![箱数]) Then ' 提醒用户 MsgBox "请输入箱数." ' 取消更新 Cancel = True End If End Sub