Private Sub txtAge_ BeforeUpdate ( Cancel As Integer )
If Me!txtAge= “” Or 【 14 】( Me!txtAge ) Then
’ 数据为空时的验证
MsgBox “ 年龄不能为空! ” , vbCritical , “ 警告 ”
Cancel=True ’ 取消 BeforeUpdate 事件
ElseIf IsNumeric ( Me!txtAge ) =False Then
’ 非数值数据输入的验证
MsgBox “ 年龄必须输入数值数据! ” vbCritical, “ 警告 ”
Cancel=True ‘ 取消 BeforeUpdate 事件
ElseIf Me!txtAge<15 Or Me!txtAge 【 15 】 Then
’ 非法范围数据输入的验证
MsgBox “ 年龄为 15 一 30 范围数据! ” , vbCritical, “ 警告 ”
Cancel= True ’ 取消 BeforeUpdate 事件
Else ’ 数据验证通过
MsgBox “ 数据验证 .K! ” , vbInformation, “ 通告 ”
End If
End Sub