I enter a record in a table. How do I get the id of that record if the id is an autonumber?
Code pleazz....
Printable View
I enter a record in a table. How do I get the id of that record if the id is an autonumber?
Code pleazz....
Im assuming by autonumber, you mean Access... The only way (I know) is to do a "SELECT id FROM table ORDER BY id DESC", and then move to the first record, that would be the last record you inserted. If you have a high volume of users, that split second select could get corrupted by another insert. I've never seen that happen, but that's not to say it can't
SQL Server has a @@IDENTITY "function" that essentially does the exact same thing - it echoes the last primary key inserted into a table.
here's some a link to some code for you, its in VB so you'll just need to convert it to VBScript
http://www.vbforums.com/showthread.p...threadid=50949