Sub form autonumber

B

bill946

How can I get the autonumber in a sub form to autonumber from 1 in every
record. At present I get say 1,2,3 in first record then 4 and 5 in record 2.
If I then make another entry in record 1 I would get 6. I just want each
record number in the sub form linked to the number in the main form.
 
D

Douglas J. Steele

You can't. That's not how Autonumbers work.

Autonumbers are intended for one purpose only: to provide a (practically
guaranteed) unique value that can be used as a primary key. Being able to
programmatically reset them takes away from the purpose. In actual fact,
it's rare to even show your users the value of the Autonumber field.

If the value of the number matters, Autonumbers are probably not the
appropriate thing to use. Instead, put logic in the subform's BeforeInsert
event to determine what the next number should be, and use that instead.
 
Top