已经解决
sql = "select * from 员工基本信息表 where 员工编号='" & rsKQ!员工编号 & "'"
Set rsYG = ExeSQL(sql)
If Not rsYG.EOF Then
intYears = DTPGongZtime.Year - Year(rsYG!进入部门日期)
intMonth = DTPGongZtime.Month - Month(rsYG!进入部门日期)
End If
If intMonth < 0 Then
GongL = intYears - 1
Else
GongL = intYears
End If
curGongLGZ = GongL * rsGZBZ!工龄工资标准