Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 16th, 2007, 02:10 PM
Authorized User
Join Date: Jun 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to use .CancelUpdate

I have a form and it has two fields (cboBroker and txtDate) and after the user clicks a cmd button, a recordsource is generated. I have all the records shown on one screen where the user is able to change the values in the recordsource. However, I was reading that ADO automatically updates the fields in the database without any command. I want to override this feature and have it so that the user has to click another command button (Commit Changes) to update the fields, otherwise, discard all updates. I was unable to use .CancelUpdate on an AfterUpdate event. I have
Private sub txtQuantity_AfterUpdate()
With Me.Recordset
End With
But it doesn't work. Any suggestions? (I would not want to use DAO, because this project was given to me and the previous person coded a lot of it using ADO)

Old June 17th, 2007, 11:25 AM
Authorized User
Join Date: Jun 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts

I tried several things so far. Just as a follow up to my first post, after the user fills in the two input fields and then clicks the cmd button, the detail page is made visible

              Col1 Col2 Col3 etc.
Record1 Fld1 Fld2 Fld3 etc.
Record2 Fld1 Fld2 Fld3 etc.

Now some of the fields in the above diagram can be edited. I'm trying to only commit the changes if the user clicks a vbyesno button and chooses yes. Otherwise all changes will be discarded if the user moves to another form.

I tried using (in ADO) cancelupdate, cancelbatch, etc. and rollbacktrans, committrans, etc, but everytime i move from one record to another, it automatically updates it with whatever is entered. Any help?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update or CancelUpdate without AddNew or Edit ru1 Access 1 October 15th, 2005 02:24 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.