Dim wrkDefault As Workspace
Set wrkDefault = DBEngine.Workspaces(0)
Dim Rst As New ADODB.Recordset
Dim Conn As New ADODB.Connection
Set Conn = CurrentProject.Connection
Dim sql1 As String
sql = "SELECT 职工, Sum(金额) AS 金额之总计 FROM 帐目表 GROUP BY 职工, 日期 HAVING (日期>=CDate('2006/9/1'))"
Rst.Open sql, Conn, adOpenDynamic, adLockOptimistic
wrkDefault.BeginTrans
Do While Not Rst.EOF
Conn.Execute "insert into 工资表(月份,职工,应发工资)values ('9','" & Rst!职工 & "', " & CStr(Rst!金额之总计) & " )"
Rst.MoveNext
Loop
If MsgBox("保存吗?", vbYesNo) = vbYes Then
wrkDefault.CommitTrans
Else
wrkDefault.Rollback
End If
点击no后,数据还是提交了,为什么? 谢谢
[此贴子已经被作者于2006-10-31 19:49:47编辑过]
|