While inserting records to an MS Access database (1) does the autonumbering occur with ODBC? (2) How is the autonumber retrieved at insertion time (it cannot be retrieved later since there are no other unique fields to select on)? (3) If autonumbering does not occur in ODBC, how do I guarantee a unique number when many users are inserting to the database? As you can tell I am a newbie.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
2) At least with tclodbc there is unfortunately no way to uniquely identify inserted record, if there are no unique fields to use in select clause.
You could try starting a transaction before insert, and then do select max(autonumberfield) before commit. Depending on implementation, this could give you correct id even in multiuser environment. (just a hint, no guarantee)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
While inserting records to an MS Access database (1) does the autonumbering occur with ODBC? (2) How is the autonumber retrieved at insertion time (it cannot be retrieved later since there are no other unique fields to select on)? (3) If autonumbering does not occur in ODBC, how do I guarantee a unique number when many users are inserting to the database? As you can tell I am a newbie.
1) Autonumbering does occur with odbc.
2) At least with tclodbc there is unfortunately no way to uniquely identify inserted record, if there are no unique fields to use in select clause.
You could try starting a transaction before insert, and then do select max(autonumberfield) before commit. Depending on implementation, this could give you correct id even in multiuser environment. (just a hint, no guarantee)