Solved

Update failed on recordset

Posted on 2007-03-30
3
253 Views
Last Modified: 2012-06-27
I am using ADO recordset. When I use AddNew method and Update to add new record, the program crash everytime on the update method.
This the error message that show up:
"The instruction at "0x7c9111de" referenced memory at "0x005f0054". The memory could not be "read".
Please help.

Here is sample code:
Set NewAdd_RS_IOF = public_RS_IOF.Clone
NewAdd_RS_IOF.Fields("USER1_VALUE") = USER1_VALUE
NewAdd_RS_IOF.Fields("USER2_VALUE") = USER2_VALUE
NewAdd_RS_IOF.Update
0
Comment
Question by:doughboy03
  • 2
3 Comments
 
LVL 15

Expert Comment

by:JackOfPH
ID: 18828009
If you are using Access Try using this connection string.
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;
0
 
LVL 15

Expert Comment

by:JackOfPH
ID: 18828014
Try using the Microsoft.Jet.OLEDB.4.0
instead of Microsoft.Jet.OLEDB.3.51
0
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 250 total points
ID: 18828029
have you tried using test text data for the new values.Just to make sure it's not the data causing the DataAccess object to crash.

Set NewAdd_RS_IOF = public_RS_IOF.Clone
NewAdd_RS_IOF.Fields("USER1_VALUE") = "my name"
NewAdd_RS_IOF.Fields("USER2_VALUE") = "your name"
NewAdd_RS_IOF.Update

check the format of the fields..... I've had problems where a string was larger length than field and it caused a non-trappable error.  Not as catastrophic as your error though!

try reading the new data before update also. Does it match ?
MsgBox NewAdd_RS_IOF.Fields("USER2_VALUE")
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question