autonumbers in multi-user app

M

miss031

I tried out the before_update autonumber code in Rogers Access Library for
numbering without using the Autonumber field format, and it does provide for
the event that two users get the same number, but I wonder, should I use this
instead of an actual Autonumber in a multi-user app where a few different
users will be posting to the same table at the same time?
 
T

Tony Toews [MVP]

miss031 said:
I tried out the before_update autonumber code in Rogers Access Library for
numbering without using the Autonumber field format, and it does provide for
the event that two users get the same number, but I wonder, should I use this
instead of an actual Autonumber in a multi-user app where a few different
users will be posting to the same table at the same time?

Unless you have a very compelling reason I'd use autonumbers. I use
them on every table on some fairly small and fairly large databases
and have never had a problem with them.

And even if you had a very compelling reason, such as an interesting
invoice number problem I'd very likely use autonumbers in that table
anyhow.

I'm not familiar with the routine in Rogers Access Library. Can you
post the relevant code here?

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
M

miss031

No,I don't know of any compelling reason. My PK's are not meaningful to the
users. I just have so far just used the artificial autonumber for my invoice
numbers, solely to keep them sequential.

As for the contact_ID's, I just wasn't sure how autonumbers behave with
multiple front ends creating records on the same table at the exact same
time. That's why I thought I'd look into other options. I've heard of
autonumbers getting corrupted, and restarting, casusing duplication.

The code below I got from Roers Acceess library,and I use it for my invoice
numbers. It prevents gaps in the numbering which an autonumber does not, but
this, again, is a meaningful number.

Private Sub Form_Error(DataErr As Integer, Response As Integer)
On Error GoTo Err_Form_Error

Response = IncrementField(DataErr)

Exit_Form_Error:
Exit Sub

Err_Form_Error:
MsgBox Err.Description
Resume Exit_Form_Error

End Sub

Function IncrementField(DataErr)
If DataErr = 3022 Then
Me!payment_trans_ID = DMax("payment_trans_ID", "tbl_payments") + 1
IncrementField = acDataErrContinue
End If
End Function
 
T

Tony Toews [MVP]

miss031 said:
As for the contact_ID's, I just wasn't sure how autonumbers behave with
multiple front ends creating records on the same table at the exact same
time. That's why I thought I'd look into other options. I've heard of
autonumbers getting corrupted, and restarting, casusing duplication.

That was a problem with one particular service pack which has long
been fixed by newer service packs. I'd definitely use autonumbers
because the alternative is a lot of extra work and not worth it in my
opinion.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top