I have created a table in ms-access table.
in that i created the invoiceno field as autonumber.
now i finished the project.
i deleted all the testing data in the table.
while im deleting the autonumber was 1027
after deleting the data completely from the table.
i tried to insert a new record.
the autonumber is coming 1028 i dont want 1028 i want to start from 1(ie. from beginning).
so how can i reset this.
AFAIK you can't, without deleting the field and re-creating it.
There are good reasons for this.
1) Autonumber is often used (unfortunately) as an index to the table. This means there could exist other rows which refer to a now deleted row by the previous autonumber. If you could reset the number, then those rows would eventually be associated with a new row instead.
In your case, imagine what trouble it would cause if you used the autonumber as an invoice number, and had a separate tablw of items on the invoice. these would then refer back to the invoice by the autonumber. If you reset the number, suddenly a customer gets invoiced for thirty items he didn't order, and hasn't had. Trouble ensues.
Personally, I hate autonumber and only ever use it when I will never refer to it: as an index for a log table for example. If you need a specific sequence of invoice numbers (and legally you do in most areas) consider writing a stored procedure to allocate a new invoice number and use a Guid for the actual database row reference instead.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)