|
用rs.movenext与前一个相减就可以实现,只是第一个不能与标题相减,所以要加on error来跳过错误
On Error Resume Next
Dim sql As String
Dim rs As ADODB.Recordset, i As Integer, t1 As Date
sql = "select * from 间隔天数表"
Set rs = New ADODB.Recordset
rs.Open sql, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
For i = 1 To rs.RecordCount
t1 = rs("时间")
rs.MoveNext
rs("天数") = Abs(Nz(DateDiff("d", rs("时间"), t1), 0))
Next
rs.Close
Set rs = Nothing
DoCmd.OpenTable "间隔天数表", acViewNormal |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|