Public Function CSNY(身份证号 As String) As Date
Dim strRq As StringIf Len(身份证号) = 15 Then
strRq = Mid(身份证号, 9, 2) & "/" & Mid(身份证号, 11, 2) & "/" & "19" & Mid(身份证号, 7, 2)
If IsDate(strRq) Then CSNY = CDate(strRq)
End If
If Len(身份证号) = 18 Then
strRq = Mid(身份证号, 11, 2) & "/" & Mid(身份证号, 13, 2) & "/" & Mid(身份证号, 7, 4)
If IsDate(strRq) Then CSNY = CDate(strRq)
End If
End Function
Dim y2 As Integer
Dim m2 As Integer
Dim d2 As Integer
y2 = Year(Date)
m2 = Month(Date)
d2 = Day(Date)
If Not IsNull(Me.文本0) Or Me.文本0 <> "" Then
If m2 - Month(Me.文本0) < 0 Or (m2 - Month(Me.文本0) = 0 And d2 - Day(Me.文本0) < 0) Then Me.文本2 = y2 - Year(Me.文本0) - 1
Else
Me.文本2 = y2 - Year(Me.文本0) End If
End If
End Sub
Public Function XB(身份证号 As String) As String
Dim i As Integer
If Len(身份证号) = 15 And IsNumeric(Right(身份证号, 1)) Then
i = CInt(Right(身份证号, 1))
If i Mod 2 = 0 Then XB = "女" Else XB = "男"
End If
If Len(身份证号) = 18 And IsNumeric(Mid(身份证号, 17, 1)) Then
i = CInt(Mid(身份证号, 17, 1))
If i Mod 2 = 0 Then XB = "女" Else XB = "男"
End If
End Function