I developed this solution because on several lists I'm on, there are questions
each week about clients wanting autonumbers displayed and they get upset when
there are gaps. They are expecting sequential numbers, and the autonumber
datatype doesn't quite match what they are looking for.
This program will allow the developer to get the next number increment. They may
request either (Max+1), or fill in missing numbers first, then get (Max+1). The code
should work in a muti-user environment. It uses semaphore logic to prevent 2 users
from retrieving the same number at the same time.
Note: This new functionality is not meant to superscede the autonumber datatype.
You should still use autonumber for relational integrity, but if the user wants a
number to see, this is a solution worth looking at.
Access Version: 2000 and probably newer.
References:
Microsoft ActiveX Data Objects 2.1 Library
Microsoft ADO Ext. 2.7 for DDL and Security Download Access 2000+ : http://www.rogersaccesslibrary.com/forum/uploads/35/Semaphore.zip - uploads/35/Semaphore.zip
------------- --
Email: mailto:GreaterDesignConcepts@yahoo.com - GreaterDesignConcepts@yahoo.com
I only ask that the comments be left intact in the code module. Otherwise, it's for use freely by whoever.
|