[AccessD] Autonumber Assigned Immediately

Susan Harkins ssharkins at bellsouth.net
Thu Sep 8 09:58:17 CDT 2005


I'm interested in knowing why Mike needs the AutoNumber before the record
actually exists?

Susan H. 

Hi Mike
As you've found out the autonumber only gets allocated when you begin to
populate a record. Anything you do to override that is potentially going to
give you problems when the user wants to cancel the creation of a record
because the autonumber will still get used up. It also means in a multi-user
situation that the next number will be got as you enter the screen not as
you write the final record. But if that's not an issue for you, or you're
prepared to deal with that then you could, for example, create a field on
your table, leave it off the form then (or make it hidden) then in the
OnCurrent have:

If Me.NewRecord then
me!fldDummy=1        'or whatever
End if

By forcing something into the record the autonumber will be got.

But, as I say, make sure you've thought the implications through.




More information about the AccessD mailing list