473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Method 'CancelUpdate' of object' _Recordset' failed

I have encountered a problem which I'm still trying to fix. I'm ADO recordset to communicate with front end (form with textboxes) and main access table. It is as follows;

Setup ado recordset

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)  
  2.     Set rst = CreateObject("ADODB.Recordset")
  3.  
  4.     With rst
  5.       .ActiveConnection = CurrentProject.AccessConnection
  6.       .Source = "SELECT * FROM MapIndex"
  7.       .LockType = 3 'adLockOptimistic
  8.       .CursorType = 1 'adOpenKeyset
  9.       '.CursorLocation = 3 ' adUseClient
  10.       .Open
  11.     End With
  12.  
  13.     Set Me.Recordset = rst
  14. End Sub
  15.  
  16. 'Function to add record and save record
  17. Private Sub cmdAddRecord_Click()
  18.  
  19. If cmdAddRecord.Caption = "Add Record" Then
  20.    UnlockRecords
  21.    rst.AddNew
  22.    GivenName.SetFocus
  23. ElseIf cmdAddRecord.Caption = "Save Record" Then
  24.     rst.Update
  25.     LockRecords
  26. End If
  27. End Sub
  28.  
  29. Private Sub cmdEditRecord_Click()
  30.         If cmdEditRecord.Caption = "Cancel" Then
  31.              rst.CancelUpdate
  32.              LockRecords
  33.         End if
  34.  
  35. End Sub
The problem is when I do a rst.CancelUpdate with text written in any textbox it throws a error saying "Multiple-step operation generated errors. Check each status value" then after it shows #Deleted in all the controls. When no text is entered in any field and then rst.CancelUpdate works fine.

Can anyone help as I've been stuck with this error for a few days now. i've already passed the time to hand in database for testing. Thanks heaps.
Dec 5 '06 #1
7 2779
NeoPa
32,556 Expert Mod 16PB
I may be wrong here, but I don't think you want to create a separate recordset and then add it to your form.
You should define a recordset for your form and access that from your code rather than vice-versa.
Dec 5 '06 #2
I may be wrong here, but I don't think you want to create a separate recordset and then add it to your form.
You should define a recordset for your form and access that from your code rather than vice-versa.
Not such want you mean though. I have setup an ADO connection & recordset which I make the form's recordset equal to when the form is opened up. Please explain the vice versa way.
Dec 5 '06 #3
Well it seems you guys dont understand my problem..will find solution elsewhere so much for discussing
Dec 6 '06 #4
NeoPa
32,556 Expert Mod 16PB
Not such want you mean though. I have setup an ADO connection & recordset which I make the form's recordset equal to when the form is opened up. Please explain the vice versa way.
The Vice-versa is what you're doing.
You should (I think) be setting the recordsource then accessing the recordset as already set rather than setting your own one.
Is that clear?
Dec 6 '06 #5
NeoPa
32,556 Expert Mod 16PB
Well it seems you guys dont understand my problem..will find solution elsewhere so much for discussing
???
I do find you difficult to understand but it is, of course, your prerogative to search elsewhere for answers.
Good luck and best wishes.
Dec 6 '06 #6
Neopa

I managed to solve this problem myself by doing extra coding and not by what you suggested..tried it but did not solve problem. Thanks anyway. yep..its better when you can solve it yourself .
Dec 6 '06 #7
NeoPa
32,556 Expert Mod 16PB
NeoPa

I managed to solve this problem myself by doing extra coding and not by what you suggested..tried it but did not solve problem. Thanks anyway. yep..its better when you can solve it yourself .
You're absolutely right. It is much better.
However, if you got that working then I have some learning to do (I was afraid of that).
Would you mind posting your solution in here so that other members and searchers can see your answer. That would be very helpful. I think I also need to look at it and learn when you do.
Well done.
Dec 6 '06 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Russ Gadagno | last post by:
Hi, I’m trying to use net remoteing with Com+. I created a wrapper for the com object. I can call the com object from my c# client and an able to get return type of strings and int’s. One of...
1
by: Jon Trelfa | last post by:
I have been fighting with this script for several days and I'm finally at the end of my rope. Here's the scenario: -I have to add an entry into 1 table, called "calendar" -I must retrieve the...
2
by: JSMiami | last post by:
I have a form that has the navigation buttons enabled. I have a procedure that runs every time a new record is loaded (Current Event). This procedure performs a SELECT from a table (different from...
2
by: NewDBGirl | last post by:
I have a multiple-page form for entering info about a project with several sub-forms for sub-projects, notes and tasks. The form and one of the sub-forms each have a combo box to select a record...
5
by: Prasad | last post by:
Hi I have a legacy DLL, that has functions which accept and return type "Variant" I want to use that DLL in .NET. I am able to use functions well that return variants but that return common data...
6
by: rob | last post by:
Dear All, I have a COM+ component that returns an ADODB.Recordset. In an include file that is included by an aspx page I assign that returned recorset to an ADODB._Recordset. Unfortunately, this...
9
bhcob1
by: bhcob1 | last post by:
Hey guys, 'Update or CancelUpdate without AddNew or Edit' On my database i keep occasionly get this error when i try and edit a field, it is not everytime. It will be working fine and then this...
1
by: Bram | last post by:
I'm writing an application using LinqToSQL. Basically the application works as follows: - Read a file - Add rows to the database (the rows belong to more than one table). - Call...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.