|
Private Sub 社员编号_BeforeUpdate(Cancel As Integer)
Dim IntA As Integer, IntB As Integer, Stra As String
Select Case Len(社员编号)
Case 10
IntA = 4
Stra = ""
IntB = 2
Case Else
MsgBox "社员编号位数错误,请重新输入!", , "提示"
Cancel = True
Exit Sub
End Select
If Not IsDate(Stra & Mid(社员编号, 1, IntA) & "/" & Mid(社员编号, 1 + IntA, 2) & "/" & Mid(社员编号, 3 + IntA, 2)) Then
MsgBox "社员编号日期错误!"
Cancel = True
Exit Sub
End If
If (Stra & Mid(社员编号, 1, IntA) & "/" & Mid(社员编号, 1 + IntA, 2) & "/" & Mid(社员编号, 3 + IntA, 2)) > Date Then
MsgBox "如果日期超前,提示社员编号日期错误!"
Cancel = True
Exit Sub
End If
入社时间 = Stra & Mid(社员编号, 1, IntA) & "/" & Mid(社员编号, 1 + IntA, 2) & "/" & Mid(社员编号, 3 + IntA, 2)
End Sub
输入社员编号自动生成入社时间,如果入社时间超前,提示编号错误
以上该如何修改,谢谢 |
|