PDA

View Full Version : Opinion with autonumbers



akn112
10-03-2007, 07:19 AM
hey all, i've been looking into changing the way my database assigns these "User Access IDs". Currently it is an autonumber field and is updated through

If UserAccessId <= 0 Then

Set adodbRecordSet = adodbconnection.Execute("SELECT @@identity", , adCmdText)
If adodbRecordSet.EOF = False Then
UserAccessId = adodbRecordSet.Fields(0)
End If
End If

I was thinking of changing it to a number field and making this alteration

If UserAccessId <= 0 Then

UserAccessId= dmax("UserAccessID", "tblAccess")
End If

What're ur thoughts on a change like that.

The reason being is i feel that number fields are much more flexible than autonumber fields. We've also had a number of occassions, where we made a ID (15), database was crashed and restored and someone made another ID(15) for another person. But i couldnt edit it cause it was a autonumber field. We had to make a new ID(16) for the person and let them know of the update.

mattj
10-03-2007, 11:36 AM
Autonumbers should be used for nothing more than a unique record identifier, and even then, only for use by the DBMS. IMHO, any unique number intended for use by the general poplulation should be a separate field.
The autonumber is not intended for "public consumption"

HTH
Matt

akn112
10-04-2007, 05:09 AM
cool, i'll keep that in mind. Thanks!