INSERT INTO statement, new record: how to grab autoid number created?
-
22-09-2019 - |
문제
I have a button click event that takes information from controls and enters it into a table via INSERT INTO SQL statement in VBA.
I was wondering if there is anything I could add to this, or some other method to acquire the record number that is created for the record?
Could I just turn around and SELECT against the table and use rs.last?
해결책
You can "SELECT @@IDENTITY" from the same DAO.Database object variable where you previously executed your INSERT statement. See here on Stack OverFlow for details.
제휴하지 않습니다 StackOverflow