[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Getting AutoID From a Record In a Transaction

Posted on 2005-04-06
Medium Priority
Last Modified: 2010-05-02
I am processing a transaction as follows:

1) Add a new record to the SALES Table which includes an AutoNum field.
2) Adding a record to the SALEDETAIL table which requires the AutoNum from the SALES table.

How do I implement this within a single transaction using the BeginTransaction and CommitTransaction function of ADO?
I tried calling them in succession but the AutoID from the SALES table is NULL. I guess it doesn't get populated until the transaction is committed.

I need to be able to roll back if there are any errors so I don't see how any other method would work. Please keep in mid also that the structure of the database cannot change. Thanks for your time!
Question by:kevman123
  • 2
LVL 14

Accepted Solution

Shiju Sasidharan earned 2000 total points
ID: 13720913

Author Comment

ID: 13721130
Wonderful! Thanks so much.
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 13723909
Thank u kevman123

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month18 days, 22 hours left to enroll

834 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