I suspect that your code will not work if someone else inserts in between the original insert and when your code finishes its loop. It looks like the @@identity variable exists in access per the following from microsofts site. I don't use access so you should look into this further.
After an insert a query like 'select @@identity' will return the last identity used by that connection. So even if another user makes an insert it won't affect the return variable. Plus it will be much faster than the other approach.
However, Microsoft Access 2000 or later does support the @@IDENTITY property to retrieve the value of an Autonumber field after an INSERT. Using the RowUpdated event, you can determine if an INSERT has occurred, retrieve the latest @@IDENTITY value, and place that in the identity column of the local table in the DataSet.