Re: Autonumbers in SQL Server Recordsets

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hum, not got enough coffee this morning: please disregard my previous
comment about the fact that you might be using DAO instead of ADO. The
LastModified property is not available with ADO recordset, however, this
doesn't mean that an ADO recordset will not change its position after an
update.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in message news:eqzHm5cgHHA.4368@xxxxxxxxxxxxxxxxxxxxxxx
Hum, this newsgroup is about ADP and not about DAO or ODBC linked tables;
so you should ask in a more appropriate newsgroup if you want to have the
correct answer; however, in your case, I think that you must use the
rs.LastModified bookmark, something in the line of:

rs.Update
rs.Bookmark = rs.LastModified
PrimaryKey_Identification = rs("PrimaryKey_Identification ")

A second possibility would be to change the nature of the recordset used.
Maybe that by opening another type of recordset, it won't change its
position after the update.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


"Declan" <Declan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CC1FB5E3-8B91-4394-A92E-050529D70D88@xxxxxxxxxxxxxxxx
In Access, an autonumber is generated as soon as you change any field
of
the record whereas SQL Server doesn't set the autonumber until the record
is
saved. In multiple places in my code, I use the Addnew method to create
a
new record, set the value of a field (for example RS!VendorName =
"Altek"),
and then, right after setting the value of the first field, save the
autonumber value to a variable for future use. How can I access the
value of
a new record's autonumber field for a recordset made from a SQL Server
table?
I tried to access the autonumber value after I issued the update method
to
the recordset, but the focus is set to the first record of the table
after an
update, and I get whatever the autonumber of the first record is.




.



Relevant Pages

  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)
  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)
  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)
  • Re: DAO to ADO Recordset Options
    ... DAO was really fast when dealing with Access data (faster than ADO) but was ... Recordset. ... For client-sided cursors, there is only Static cursor type regardless as ... determines how often data is fetched from the server. ...
    (microsoft.public.data.ado)
  • Re: Is ADO Dead (3)?
    ... The Design of ADO ... ADO uses a single object, the Recordset, as a common representation for ... a forward-only stream of results from a database, ... where data is updated at the data source or cached locally as with the ...
    (comp.databases.ms-access)