Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get the last inserted id, when it is autonumber?

Status
Not open for further replies.

Petal

Programmer
Jun 8, 2001
56
NO
Hi

I have this sql-statement:
Sql = "insert into user(user_name) values('"&Request.Form("user_name")&"')"
objCommand.execute(sql)

In the table user I have column named user_id that is autonumber.(MS Access).

How can I get the last inserted user_id?

Can I do it in another way than:

Sql="select user_id from user where user_name='"&Request.Form("user_name")&"'"

Please help me Jørn Arild Andenæs
jaa@jaa.no
 
use this to go to the last record
user_id.MoveLast I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top