Sub 格式(ctl As Control)
Dim B As Boolean
B = Left(Me.txt1, 1) = "0" Or Left(Me.txt1, 1) = "-"
B = B And Len(Mid(ctl.Value, InStr(ctl.Value, "."))) <= 4
If B = False Then
ctl.Value = "格式错误!请重新输入!"
ctl.SetFocus
End If
End Sub
Private Sub txt1_AfterUpdate()
Call 格式(me.txt1)
End Sub
Private Sub Txt2_AfterUpdate()
Call 格式(me.txt2)
End Sub