There is usually no reason to MoveFirst
if you have not previously navigated the record set.
The overflow
is unrelated to the database code and is caused by rs!ID
not fitting in a VBA integer
(16 bit) so make temp
a Long
instead (32 bit) and remove MoveFirst
.