Page 1 of 1

Reset Auto Number

Posted: Mon Feb 29, 2016 4:24 pm
by mobilemcclintic
Is there a way to rest the auto number function?
I built and tested a form and now would like it to start again at 1.
I tried deleting the rows from the autonumber table, but that didn't help.

Re: Reset Auto Number

Posted: Mon Feb 29, 2016 4:43 pm
by mobilemcclintic
Thank you for reading.
I reset this by running a query in HeidiSQL
alter table auto_xxx_xxxx AUTO_INCREMENT=1

My other question has a related thread around here somewhere.

Re: Reset Auto Number

Posted: Tue Mar 01, 2016 1:34 am
by mobilemcclintic
I thought I could use the live demo to get a code to pick a new auto number only when saving a new record, but it looks like the invoice in the demo pulls a new number when creating a new invoice.
This behavior allows you to create an invoice, not save, go back, and create another one, skipping an incremented number.
I am hoping to only pull a new number when the record is saved.
I am trying to do it in custom code / before save.

Re: Reset Auto Number

Posted: Thu Mar 17, 2016 4:23 am
by admin
mobilemcclintic,

Try doing it After Save because Before Save won't have a new Primary Key assigned (#RECORD_ID#)

Steven