Solved

Update failed on recordset

Posted on 2007-03-30
3
250 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now