Append an open record

Hello,
I am trying to flag a record in an open Recordset that was opened as adOpenDynamic with a ADODB connection.  I have the cursor on the Active record that I want to append but the AddNew method gives me error 3251 "Object is not capable of performing the operation".  Is there a way to do it with the Recordset or will I have to write and issue a INSERT SQL statement?

Thanks for reading this!
LVL 4
GlowmanAsked:
Who is Participating?
 
rkot2000Connect With a Mentor Commented:
to modify a field:
rs.field("xxx").value = rs.field("xxx").value + 25
rs.update

where xxx - your field name.
0
 
rkot2000Commented:
can you post your rs.open code ?
0
 
GlowmanAuthor Commented:
Us.Open SQL, Conn, adOpenDynamic

Where Us is a ADODB.Recordset and Conn is the connection to the active database.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
rkot2000Commented:
I need to see your sql. in somecases sql may produce a readonly recordset.
0
 
rkot2000Commented:
or you can try to add this :

Dim x As ADODB.Recordset
x.Open sql, con, adOpenDynamic, adLockOptimistic
0
 
rkot2000Commented:
yep adLockOptimistic shoud work because :


adLockReadOnly (Default) Read-only—you cannot alter the data.
0
 
GlowmanAuthor Commented:
OK. that got past that error.  Now what seems to be happening is that it is creating an entirely new record and I would like to just add a value to a field in the record that I am on.
0
 
GlowmanAuthor Commented:
OK. that got past that error.  Now what seems to be happening is that it is creating an entirely new record and I would like to just add a value to a field in the record that I am on.
0
 
GlowmanAuthor Commented:
Perfect. I don't know why I thought I had to AddNew but thanks for your great answers.
0
 
rkot2000Commented:
rs.fields not rs.field
0
 
GlowmanAuthor Commented:
Perfect. I don't know why I thought I had to AddNew but thanks for your great answers.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.