Click to See Complete Forum and Search --> : This is more of an ADO question, but...


phpnovice
02-10-2005, 01:31 PM
Is there a way to easily find out what is the resulting value in an autoincrement column after issuing the following against an Access database:

conn.Execute "Insert ..."

For example, with PHP and MySQL, there is a MySQL function you call to get the last autoincrementd value after SQL Insert over a particular database connection. Can this be done with ADO/Access? ...or, do you have to execute a Select query to try to find this information? What?

Thanks.

phpnovice
02-10-2005, 02:42 PM
I may have Googled-out my own answer:

rst.Open "SELECT @@IDENTITY;", conn
lngId = rst.Fields(0).Value

I'm checking... :D