我是想在数据库中做一个记录各个用户使用时间的程式,当关闭数据库时,可以把关闭的当时时间记录到相应的表中,使用下面的语句却不成功,不可以把当时的时间添加到相应的字段中去,请各位高手帮一把,看看哪里错了,谢谢!
Sub ExitTime()
Dim rs1 As Recordset
Dim cmd1 As Command
Set cmd1 = New ADODB.Command
With cmd1
.ActiveConnection = CurrentProject.Connection
.CommandText = "select * from recorde where users='" & Me![Text34] & "' "
.CommandType = adCmdText
.Execute
End With
Set rs1 = New ADODB.Recordset
rs1.Open cmd1, , adOpenKeyset, adLockPessimistic
rs1.MoveLast
rs1.Fields(5) = Now
End Sub
[em09][em09][em09][em09][em09]
Sub ExitTime()
Dim rs1 As Recordset
Dim cmd1 As Command
Set cmd1 = New ADODB.Command
With cmd1
.ActiveConnection = CurrentProject.Connection
.CommandText = "select * from recorde where users='" & Me![Text34] & "' "
.CommandType = adCmdText
.Execute
End With
Set rs1 = New ADODB.Recordset
rs1.Open cmd1, , adOpenKeyset, adLockPessimistic
rs1.MoveLast
rs1.Fields(5) = Now
rs1.update
End Sub