UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> SQL Insert Statement Resetting Autonumber valud    
 
   
NeoJeff
post Apr 22 2004, 11:15 AM
Post #1

UtterAccess Addict
Posts: 170
From: Waco, TX



I used a SQL Statement to insert a record into an existing table. When I added a the new record, I set the Keyfield (which is defined as AutoNumber) to -1. I did this because I need to be able to trask this in my customers database. The user can also add records to this table.

Once I add this record, my next value for the autonumber is 0. Knowing this, I have two questions:

1. Is there anyway to do what I did and NOT have it reset the autonumber?
2. Is there anyway from code to reset the next value once it's messed up. I know I can open the database and copy/paste the table (or import it) to reset it.

Jeff
Go to the top of the page
 
+
Jack Cowley
post Apr 22 2004, 11:32 AM
Post #2

Retired Moderator
Posts: 37,716
From: The San Francisco Bay Area



I would not mess with autonumbers as they are meant only to provide a unique way for Access to identify every record. You might want to consider adding a boolean field to your table and then check the record you want so you can identify it later.

Autonumbers are not meant to be used by humans but are strictly for Access to identify records. If you are trying to use autonumbers in any other way then you need to reconsider how you are keeping track of your records.

hth,
Jack
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 24th May 2013 - 05:36 PM