Urgent !: Reset autoincrement Value ?

  • Thread starter Thread starter Grigol Avetikov
  • Start date Start date
G

Grigol Avetikov

Hi,
I have a datatable filled from MS Access database with autoincrement. field.
when i'm entering information everything is ok. But once I clear datatab;e
and open another database wich is empty and adding new records,
Autoincrement values continue from previous table values.For now it works so
that everytime i want to change database i have to close the programm and
run again , otherwise it does not reset the value of autoincrement field.
Example :
1 . I open db1.mdb with tbl1 table . there are rows with autoincrement
values from 1 to 10.
2 .I add new record and new autoincrement column value is 11.
3. Save table to database and clear datatable.
4. open another database (same scheme )where the table is empty.
5 Problem : add new record to empty table and autoincrement value is 12
instead of 1.
Question : How can i reset Autoincrement column in datatable next value to 1
?
 
Hi Grigol,

You should use negative values for newly assigned autoinc ids.
So you can distinguish real and temporary ones.
Also, it doesn't matter the value of temporary id (new rows) as it
will/should be replaced with database assigned one when you save to
database.
 
Back
Top