ProjectExplorer
Programmer
I am adding a new record to an Access table using a OleCommand and SQL string containing "INSERT INTO tblOrders etc...." The back end table contains a AutoNumber field to generate a unique Order ID ("OID")as soon as the new record details are inserted by the code.
My problem is that I need to get the new Order ID (OID) as soon as the record is added (inserted) into the table but I cannot see how I do this with ADO.
I used to do this in ACCESS DAO using:
With rstOrders
.AddNew
.Fields ("Packs") = Me.cboPacks ' i.e. number of packs
intOID = .Fields ("OID") ' GET THE NEW ORDER ID
.Update
.Close
End With
Basically you could grab the new Order ID (OID) as soon as the new record was created (because DAO remains connected to the database).
I am not not how I can recreate this with ADO or what approach to take to acheive it.
Any help much appreciated.
Thanks
My problem is that I need to get the new Order ID (OID) as soon as the record is added (inserted) into the table but I cannot see how I do this with ADO.
I used to do this in ACCESS DAO using:
With rstOrders
.AddNew
.Fields ("Packs") = Me.cboPacks ' i.e. number of packs
intOID = .Fields ("OID") ' GET THE NEW ORDER ID
.Update
.Close
End With
Basically you could grab the new Order ID (OID) as soon as the new record was created (because DAO remains connected to the database).
I am not not how I can recreate this with ADO or what approach to take to acheive it.
Any help much appreciated.
Thanks