Return Primary Key of Last Append Query
Ok, I'm new to Access and am working with an Access 2000 database. I know that in MS SQL that you can make a stored procedure to insert data into a table and then return the identity of the record inserted (return @@identity).
I would like to create a query to do the same in access. Is there a was I can do this. Currently I have a button that will duplicate a previous order (company name, contact, address, etc...) to populate the fields of a new order. The run another query to select the last item that was inserted into the table. Yet because there are about 6 users who use this table, sometimes when a two people duplicate it will return the wrong order. So then my other way (which seems to work alright) is that the select query select the last order with the specific company information. But I would like to know for future events and it seems the way I am currently completing this task can possibly use a lot of resources down the line.
|