Solved

Update failed on recordset

Posted on 2007-03-30
3
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel - Save a copy of work book 13 91
TT Auto Dashboard 13 101
MsgBox 4 71
adding "ungroup sheets" to existing vbs code 5 57
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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

730 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