Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reset Auto Number? 6

Status
Not open for further replies.

PepperPepsi

Programmer
Aug 3, 2000
241
US
Hi,

i wanna know how to reset the auto number,
what happen is, if i delete all my records, the auto number field did not change back to zero.

thanks, Chiu Chan
WebMaster & Software Engineer
emagine solutions, inc
cchan@emagine-solutions.com
 
Run a compact on the database after deleting the records, then the autonumber will reset.

Joe Miller
joe.miller@flotech.net
 
Hi!

By using of Autonumber proceed lot of problems when you are needed to export/import data as well as reset of autonumber. Because I never use autonumber but always use Long or Integer data type fields. For new record update from form I write in the procedure Form_BeforeInsert following codes:

private sub Form_BeforeInsert(cancel as integer)
if dcount("MyField","MyTable")=0 then
me.MyField=1
else
me.MyField=dmax("MyField","MyTable")+1
endif
End Sub

Aivars
 
Hi guys,

Joe, it works great, thanks~
Alivars, thanks for the advise, i will consider it~

thanks, Chiu Chan
WebMaster & Software Engineer
emagine solutions, inc
cchan@emagine-solutions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top