Hmmmmmmmmmmmm -
DMAX CANNOT guarntee uniqueness. Which is the "Saving Grace" of AutoNumber. Although there are problems using autonumber in a multiuser environment.
As a 'compromise' between these, I wrote a routine to generate a customized and unique value as a 'pseudo' autonumber. I also posted the 'generic' version as faq700-184 -which, I am told is not for the faint of heart, although it seems straighforward to me, there are numerous small changes which are necessary to fit it into a specific app.
As for the 'down side' of DMax, you really should understand that is is nothing but a poor (programmers) avoidance of writting a simple query. (Select Max([MyField]) as TheMax From [MyTbl]

?? So why invoke the wrapper procedure to build the query string from information you need to supply anyway? After all, once the query is 'built', little olde Ms. A. will insist on 'compiling' it to check for syntax errors EVERY TIME it is used - so you really are just introducing delays in processing of EVERTHING?
Neither DMax or AutoNumber can - by themselves provide the functionality requested here, I am not sure that I would agree to implement the function in any real app. Even if the monotomically incrementing value is generated, most dbs will eventually permit "deletions" - which would immediatly destroy the nice little uniformity of incrementing values. So, one either needs to renumber the entire set (and then need to deal with any and all relationships built on the value), or accept gaps in the sequence. I -for one- long away and far ago accepted (actually ran to embrace) the gap approach and have never looked back on the decision (at least not in the sense of questioning it).
Simplistically viewed, the process of generating any "AutoNumber" type is to 'guarntee' the uniqueness of the value so it can be used as a PRIMARY KEY.
DMax fails in the multiuser environment, as previously stated.
AutoNumber is often rejected as many 'programmers' feel that the 'waste' of the few (6?) bytes per record to generate a value which no USER needs is poor practice.
(although many of these SAME programmers do not hesitate to accept the default field sizes for other data types, (String 255 ring a bell here?) or to deliberatly size fields 'generously' to accomodate the VERY occassional XXX size value (Ever seen a FIRST Name field as String 35? - EVER Seen such a thing actually NEED all {35}?)
My 'compromise' suggest that you may want some 'useable value' and STILL want a PRIMARY KEY. The ONLY answer to this is to 'roll your own'.
MichaelRed
m.red@att.net
Searching for employment in all the wrong places