Problem determining new autonum value after UPDATE before UPDATEBATCH

From: Scott M (scottm1100_at_yahoo.com)
Date: 07/27/04


Date: Tue, 27 Jul 2004 14:32:05 -0700

Using ADO 2.6 in VBA (Access 2002):

I need to know how to determine the value of the autonum field after issuing
an update statement within a batch transaction. Ex:

Dim An = Integer ' Autonumber value
Rst.open sql, cnn, adOpenDynamic, adLockBatchOptimistic
Rst.Addnew
Rst.Fields(1)=bla
Rst.Fields(2)=bla
Rst.Update
An=Rst.Fields(0) <---- returns a blank or null value
Rst.Addnew
Rst.Fields(1)=bla
Rst.Fields(2)=bla
Rst.Update
An=Rst.Fields(0) <---- returns a blank or null value
Rst.UpdateBatch
An=Rst.Fields(0) <---- returns autonum value of last record updated

How can I read the value of fields(0) (my autonum) prior to issuing the
UpdateBatch?
Your help is greatly appreciated.
Scott



Relevant Pages

  • Re: Problem determining new autonum value after UPDATE before UPDATEBATCH
    ... You could use SELECT @@IDENTITY SQL statement to get latest identity value ... > an update statement within a batch transaction. ... > How can I read the value of fields(my autonum) prior to issuing the> UpdateBatch? ...
    (microsoft.public.data.ado)
  • Restart Autonum in VBA
    ... I have a table with an AutoNum field. ... and reloaded from external data. ... When I clear out the table, I want the Autonum to restart at ...
    (microsoft.public.access.modulesdaovba)