Solved

Append an open record

Posted on 2002-04-18
11
151 Views
Last Modified: 2011-10-03
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!
0
Comment
Question by:Glowman
  • 6
  • 5
11 Comments
 
LVL 5

Expert Comment

by:rkot2000
Comment Utility
can you post your rs.open code ?
0
 
LVL 4

Author Comment

by:Glowman
Comment Utility
Us.Open SQL, Conn, adOpenDynamic

Where Us is a ADODB.Recordset and Conn is the connection to the active database.
0
 
LVL 5

Expert Comment

by:rkot2000
Comment Utility
I need to see your sql. in somecases sql may produce a readonly recordset.
0
 
LVL 5

Expert Comment

by:rkot2000
Comment Utility
or you can try to add this :

Dim x As ADODB.Recordset
x.Open sql, con, adOpenDynamic, adLockOptimistic
0
 
LVL 5

Expert Comment

by:rkot2000
Comment Utility
yep adLockOptimistic shoud work because :


adLockReadOnly (Default) Read-only—you cannot alter the data.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 4

Author Comment

by:Glowman
Comment Utility
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
 
LVL 4

Author Comment

by:Glowman
Comment Utility
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
 
LVL 5

Accepted Solution

by:
rkot2000 earned 75 total points
Comment Utility
to modify a field:
rs.field("xxx").value = rs.field("xxx").value + 25
rs.update

where xxx - your field name.
0
 
LVL 4

Author Comment

by:Glowman
Comment Utility
Perfect. I don't know why I thought I had to AddNew but thanks for your great answers.
0
 
LVL 5

Expert Comment

by:rkot2000
Comment Utility
rs.fields not rs.field
0
 
LVL 4

Author Comment

by:Glowman
Comment Utility
Perfect. I don't know why I thought I had to AddNew but thanks for your great answers.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

743 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

18 Experts available now in Live!

Get 1:1 Help Now