Solved

Oracle, RDO Updateable RS and .AddNew

Posted on 1999-01-14
8
196 Views
Last Modified: 2012-05-05
Greetings,
I'm having a little problem with an Updateable  RDO
resultset (rdOpenKeySet, rdrdConcurBatch). My .Update and .BatchUpdate work fine for Updates.
My .AddNew & .Update work fine for Adds but when I try to .BatchUpdate after an .AddNew has occurred I receive the following error:
 
Client Cursor:20 Cannot perform Update with an empty row.

Here is my Add code(the top portion is because there is a join in the rs):

rsPromoCust("TypeID").SourceTable = "TypePromotions"
rsPromoCust("TypeID").KeyColumn = True
rsPromoCust("PromotionID").SourceTable = "TypePromotions"
rsPromoCust("PromotionID").KeyColumn = True
rsPromoCust("DeActivatedOn").SourceTable = "TypePromotions"
rsPromoCust("StartDate").SourceTable = "TypePromotions"
rsPromoCust("EndDate").SourceTable = "TypePromotions"
   
rsPromoCust.AddNew
rsPromoCust("TypeID") = "" & CustDetail & ""
rsPromoCust("PromotionID") = "" & Promo & ""
rsPromoCust("StartDate") = Format(StartDate, "DD-MMM-YY")
rsPromoCust("EndDate") = Format(EndDate, "DD-MMM-YY")
rsPromoCust("TypeID") = "" & CustDetail & ""
rsPromoCust.Update

Any help would be appreciated.

Thanks,
Brad
0
Comment
Question by:bhummel
  • 4
  • 4
8 Comments
 
LVL 10

Accepted Solution

by:
caraf_g earned 150 total points
ID: 1456256
After you've done the .AddNew, you are actually not positioned at the record you've just added. You're not positioned on anything at all.

So you'll have to create a new result set to retrieve the record you've just added so that you can then update it.
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1456257
Having said that... why don't you just move the code after the .AddNew to before the .AddNew and leave the .Update out altogether?
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1456258
Or could it be that .Update is actually the wrong method and you intended to do something different? (You are talking about BatchUpdate in your question)
0
 

Author Comment

by:bhummel
ID: 1456259
Actually, what I want to do is all of my updates as well as any adds and then use a .BatchUpdate to Commit the changes through a save button or .CancelBatch to cancel all of the changes through a cancel button.

BatchUpdate does this for changes. My problem is with the Add's. Where does the .AddNew place the record in the rs?

Thanks,
Brad
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:bhummel
ID: 1456260
Actually, what I want to do is all of my updates as well as any adds and then use a .BatchUpdate to Commit the changes through a save button or .CancelBatch to cancel all of the changes through a cancel button.

BatchUpdate does this for changes. My problem is with the Add's. Where does the .AddNew place the record in the rs?

Thanks,
Brad
0
 

Author Comment

by:bhummel
ID: 1456261
Actually, what I want to do is all of my updates as well as any adds and then use a .BatchUpdate to Commit the changes through a save button or .CancelBatch to cancel all of the changes through a cancel button.

BatchUpdate does this for changes. My problem is with the Add's. Where does the .AddNew place the record in the rs?

Thanks,
Brad
0
 

Author Comment

by:bhummel
ID: 1456262
Actually, what I want to do is all of my updates as well as any adds and then use a .BatchUpdate to Commit the changes through a save button or .CancelBatch to cancel all of the changes through a cancel button.

BatchUpdate does this for changes. My problem is with the Add's. Where does the .AddNew place the record in the rs?

Thanks,
Brad
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1456263
.AddNew doesn't place the record in the rs

To retrieve the newly added record in an rs you'll have to re-create an rs
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

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 …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 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

22 Experts available now in Live!

Get 1:1 Help Now