|
代码:
Public Function datedistance(a, b)
Dim a, b As Date
If b < a Then
msg "后面日期小于前面日期,请检查取值是否正确"
Else
If Year(a) = Year(b) Then
If Month(a) = Month(b) Then
datedistance = Day(b) - Day(a) + 1
Else
datedistance = Day(b)
End If
Else
datedistance = Day(b)
End If
End If
End Function
-------------------------------------------
Private Sub Command7_Click()
Dim strsql1, strsql2, strsql3, strsql4, strsql5 As String
strsql1 = "UPDATE 宿舍管理 SET 宿舍管理.会计期间 = [Text3]"
strsql2 = "UPDATE 宿舍管理 SET 宿舍管理.应承担天数 = datedistance(宿舍管理.入住日期,宿舍管理.搬离日期)"
doCmd.RunSQL strsql2
End Sub
我觉得第一行已经定义了datedistance这个函数,怎么后面用不了啊 |
|