Solved

Append an open record

Posted on 2002-04-18
11
156 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
[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
  • 6
  • 5
11 Comments
 
LVL 5

Expert Comment

by:rkot2000
ID: 6951062
can you post your rs.open code ?
0
 
LVL 4

Author Comment

by:Glowman
ID: 6951084
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
ID: 6951095
I need to see your sql. in somecases sql may produce a readonly recordset.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 5

Expert Comment

by:rkot2000
ID: 6951103
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
ID: 6951109
yep adLockOptimistic shoud work because :


adLockReadOnly (Default) Read-only—you cannot alter the data.
0
 
LVL 4

Author Comment

by:Glowman
ID: 6951113
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
ID: 6951130
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
ID: 6951131
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
ID: 6951142
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
ID: 6951143
rs.fields not rs.field
0
 
LVL 4

Author Comment

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

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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 …
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…
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…

738 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