Re: How to retrieve the new ID from Access
Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance
- From: "Jeff Johnson [MVP: VB]" <i.get@xxxxxxxxxxx>
- Date: Wed, 8 Mar 2006 14:28:01 -0500
"Ella" <ellakayeekwan@xxxxxxxxx> wrote in message
news:1141832518.203897.201630@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am using the .AddNew method of a recordset to add a new record. When
a new record is added, Access will generate an automatic ID for that
record. How can I retrieve the ID right after I .Update the database? I
don't want to close the recordset. Do I have to recreate another SQL
command and another recordset to retrieve the ID?
With DAO you would do this:
Set rsWhatever.Bookmark = rsWhatever.LastModified
MyNewID = rsWhatever("IDColumnName").Value
I don't know if ADO supports such a thing (and I have the feeling it
doesn't, but check anyway).
.
Relevant Pages
- Re: Help - Timing Logic
... from the database ... ... now you either need to incorporate a locking procedure ... ... opposed to building the transaction in the code. ... implement as above locking only the records you retrieve / update - need ... (microsoft.public.dotnet.languages.vb) - Re: OT: MySQL versus PostgreSQL and database design
... to retrieve all the events at once. ... can make that a primary key in the database. ... likely to want to retrieve all at once, without any sorting. ... different the event types are -- if they've all got exactly the same ... (rec.crafts.metalworking) - Re: DOCX FILE CORRUPTED WHEN RETRIEVED FROM SQL2005
... I am facing the same problem and would appreciate your reply on the same as it has become a show stopper for me now. ... My Code is given below to retrieve the docx content from SQL 2005 whose data type is image. ... Here is the code where i insert the file into database. ... when I store these files to the server, using the code below and similar ... (microsoft.public.office.developer.vba) - Re: OT: MySQL versus PostgreSQL and database design
... to retrieve all the events at once. ... in a way that you can avoid any real searching in your application, ... can make that a primary key in the database. ... I was thinking of sorting the events into different tables so that each table contains one type of event - specifically a subset of events that I'm likely to want to retrieve all at once, ... (rec.crafts.metalworking) - Re: Getting a (non-radio) buttons index number from array
... index in the Comment array of the button that was fired. ... you don't need js if you print out the full DOM ... There needs to be some unique way to identify the row in the database. ... Then it's easy to retrieve the ... (comp.lang.php) |
|