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