Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-24-2003, 01:40 PM   #1
KHStump
Junior Member
 
Join Date: Nov 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
KHStump
Update Query Action Button on Form

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

KHStump is offline   Reply With Quote
Old 11-24-2003, 08:41 PM   #2
Pat Hartman
Super Moderator
 
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 28,316
Thanks: 15
Thanked 1,601 Times in 1,520 Posts
Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all
You should not be running a query to update the recordset bound to the form. Either unbind the form or ditch the update query.
__________________
Bridge Players Still Know All the Tricks
Pat Hartman is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump




All times are GMT -8. The time now is 05:03 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World