I am attempting to update a record in a table by using an update query. This works perfectly when I run the query, but when I attempt to run the query using an action button on a form, I am having trouble. The record is updated, but at the same time it is adding a new record. Any idea why this would be happening. I am accessing the form through a switchboard and the record is filtered.
Private Sub Update_Click()
On Error GoTo Err_Update_Click
stDocName = "Routing_Main Query"
DoCmd.OpenQuery stDocName, acNormal, acEdit
'Me.Refresh
Exit_Update_Click:
Exit Sub
Err_Update_Click:
MsgBox Err.Description
Resume Exit_Update_Click
End Sub
Private Sub Update_Click()
On Error GoTo Err_Update_Click
stDocName = "Routing_Main Query"
DoCmd.OpenQuery stDocName, acNormal, acEdit
'Me.Refresh
Exit_Update_Click:
Exit Sub
Err_Update_Click:
MsgBox Err.Description
Resume Exit_Update_Click
End Sub