wrussell051197
asked on
Retrieving an autonumber field
How can I retrieve the autonumber field from a record I just added, I tried the following:
' created rs as a recordset and queried the database
rs.addnew
rs("field1") = "data"
rs("field2") = "data"
rs.update
id = rs("autonumfield")
but rs("autonumfield") does not return the value that was put into the field, however it does show up when I query the database.
Thanks for any help you can provide.
' created rs as a recordset and queried the database
rs.addnew
rs("field1") = "data"
rs("field2") = "data"
rs.update
id = rs("autonumfield")
but rs("autonumfield") does not return the value that was put into the field, however it does show up when I query the database.
Thanks for any help you can provide.
Are you using Microsoft Access or SQL Server?
ASKER
Currently I'm using MS Access, but I may be switching over to SQL in the near future. SQL is SELECT @@IDENTITY isn't it? Or something similar if I remember rightly. Right now I just need the technique to get it from Access.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's it, thanks!