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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with my AutoEntry feild

Status
Not open for further replies.

briggsy79

Programmer
Feb 23, 2001
68
SE
Hi, I have a database which i created in Access and are working with in VB (Accessing it with Jet).
One of the seven fields is an ID that should open automatically. I have it appearing each time a new record is created but if one is deleted the database doesn't go back to the previous ID. It doesn't recalculate so to speak. Any help would be great and thank you for reading this long.
eg. the third record has an ID of 3 if i delete it and add a new one the new record's ID is 4, which is not correct.
 
Hi,

In Access, the autonumber field is generated by Access and it is not supposed to go back. This is what keeps the id field always unique. The autonumber field is used to link related tables.

If you are relying on this id field to be sequential you can always create another field: IDNum of type text. You can then control the numbering in your code. When a record is deleted you would then have to go through easch record and renumber them either with a function or an update query. This probably makes the purpose of the numbering useless. <g>

Have a good one!
BK
 
is the related record deleted also then Yes : Compact then the database (via Access Tools) Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top