vb问题,高手进
access数据库中有table1 table2,我想让table1中记录通过字段tjtime (YYYY.mm.dd型文本) 三天后自动转入table2Dim rsTmp As New ADODB.Recordset
Dim i As Integer
Dim sql As String
sql="select cdate(tjtime) from table1 where DATEPART(DAY,'now()') - DATEPART(DAY,'cdate(tjtime)') > 3"
Adodc1.RecordSource = sql
rsTmp.Open "select * from table2", pubCnn.ConnectionString, adOpenKeyset, _
adLockOptimistic, adCmdText
rsTmp.AddNew
For i = 0 To 11
rsTmp.Fields(i).Value = Adodc1.Recordset(i).Value
Next
rsTmp("otime").Value = Date
rsTmp.Update
With Adodc1.Recordset
.Delete
.UpdateBatch
MsgBox "有" & Adodc1.Recordset.RecordCount & "条记录转入过期表", vbInformation, "提示"
End With
Set rsTmp = Nothing
Exit Sub
这段代码该怎么改呢 --------------------编程问答-------------------- access做不了自动转。 --------------------编程问答-------------------- 在客户端上定时执行这样的语句就行了:
sqlstr="insert into table2(columnlist)
select * from table1 where tjtime<dateadd(""d"",-3,date())"
conn.execute sqlstr
sqlstr="delete from table1 where tjtime<dateadd(""d"",-3,date())"
conn.execute sqlstr
就OK了.
补充:VB , 数据库(包含打印,安装,报表)