@linq is correct - assigning an autonumber with dmax needs to be left to the very last moment, before you finally write the record.
if you need it earlier, because you want to record it on a log sheet for example, an alternative is to read the next number from a table, and then increment the numberin the table for the next user. However, you do then run the risk of leaving gaps in the sequence, if you cancel your entry. This is similar to an autonumber in fact - except that you may find an autonumber will jump to a different sequence from time to time.
The reason an autonumber is not what you want, is because an autonumber cannot guarantee an intact sequence.