ramone Posted October 6, 2005 Posted October 6, 2005 hello, how can i get the value of the autonumeric key field for the last inserted row in an ms access database using odbc (something like mysql's mysql_insert_id() function)?? thank you Quote
kejpa Posted October 6, 2005 Posted October 6, 2005 Hi! I'm not so sure you can... The only way I know of is to read the table just after the insert is done. But there is one catch... Access isn't a multiuser database by design and thus there are no functions to handle such things as multiple inserts at the same time. Rows will most likely be inserted but you can't be sure that you're the one that inserted last record. You could try to use transaction handling to insert, retrieve the record with the latest ID and try to match your values with that record and commit if they match and rollback if they don't and loop until you're done. Ought to work but I haven't tried it, only use Access for single user applications. HTH /Kejpa Quote
*Experts* Nerseus Posted October 6, 2005 *Experts* Posted October 6, 2005 Check out this link. It's old, but still valid. You can search for "autonumber access" to find other threads, but they're mostly the same. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.