代码添加另一条记录,而不是对其进行更新

时间:2018-07-25 15:58:28

标签: ms-access-2010

我的程序只有两个按钮,分别是超时和超时。

但是每次我尝试更新超时记录时,都会向表中添加另一条记录。

Private Sub Form_Load()

End Sub

Private Sub Command536_Click()

strSQL1 = "UPDATE BreakSked SET BreakSked.EndTime = '" & Me.Text412.Value & "',BreakSked.Duration = '" & durationz & "' " & vbCrLf & _
"WHERE (([BreakSked].[AgentID]='" & Me.List423.Value & "'));"
CurrentDb.Execute strSQL1
CurrentDb.Close
MsgBox "OK", vbOKOnly, "Added"

End Sub

Private Sub Command520_Click()

strSql = "INSERT INTO BreakSked (ShiftDate,AgentID,StartTime,Status) VALUES ('" & Me.Text373.Value & "', '" & Me.List423.Value & "', '" & Me.Text373.Value & "','" & Me.Page657.Caption & "')"

CurrentDb.Execute strSql
CurrentDb.Close

MsgBox "OK", vbOKOnly, "Added"


End Sub

0 个答案:

没有答案