mobile databases, mobile forms, and mobile synchronization … where you need to work
Providing Pocket Access, Mobile Database, Windows CE Database, and Windows CE Development Solutions

Tip of the Month (December 2004)

Resetting the Autonumber

An autonumber control can be used to generate unique numbers when a record is created. They are meant to be used to generate an identifier (a.k.a. primary key) for the record.

At the time the form comes up, Visual CE notices that there is an autonumber control on the form so Visual CE figures out the next number to use. The number is always the larger of (a) the "starting number" specified in the control properties, and (b) the number already assigned to any of the existing records.

On occasion, you may want to reset the autonumber counter back to zero. Just selecting OPTION | CLEAR does not reset this counter since OPTION | CLEAR creates a new record (with the next higher number). Say you had a form (MyForm.vce) that had an autonumber control connected to the IDENT column. This three command macro will reset the counter:

Command 1: OPTION | CLEAR
Command 2: ASSIGN 0 to IDENT
Command 3: RUN MyForm.vce