Update Query Action Button on Form (1 Viewer)

KHStump

New member
Local time
Today, 07:48
Joined
Nov 4, 2003
Messages
7
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:48
Joined
Feb 19, 2002
Messages
43,266
You should not be running a query to update the recordset bound to the form. Either unbind the form or ditch the update query.
 

Users who are viewing this thread

Top Bottom