发表于:2013-11-22 浏览:95 作者: 来源:互联网
关键字:
描述:在ACCESS表里如何将用用户身份证号码变成出生日期(即年月日)?在ACCESS里那个菜单下编程?具体怎么操作,能说详细点吗?谢谢了
以下是代码片段:
创建一个函数: ‘根据身份证获
在ACCESS表里如何将用用户身份证号码变成出生日期(即年月日)?在ACCESS里那个菜单下编程?具体怎么操作,能说详细点吗?谢谢了
以下是代码片段:
创建一个函数: ‘根据身份证获取出生年月日 Public Function GetBirthday(ByVal str As String) As Date Dim dt As Date If Len(str身份证号) = 15 Then ‘注意:需要区分2000年出生的、2000年后出生的 dt = DateSerial("19" & Mid(str, 7, 2), Mid(str, 9, 2), Mid(str, 11, 2)) ElseIf Len(str身份证号) = 18 Then dt = DateSerial(Mid(str, 7, 4), Mid(str号, 11, 2), Mid(str, 13, 2)) Else dt = CDate("1900-01-01") End If GetBirthday = dt End Function |