Auto-number and new record...

P

polman

Odd behavior (at least for me): When I use the Me.Recordset.AddNew to
add a new record the autonumber key increases by 2 while with
DoCmd.GoToRecord , , acNewRec it increases by one as expected. (No esc
key has been pressed in either case).
Furthermore, what is the best way to auto-assign a unique ID number for
new records in a multiuser environment? (I read some discussions, in
this forum but I 'm not yet have a conclusion).
Thank you.
Manolis
 
A

Allen Browne

If the number is skipping one, there is something in your process that
starts an insert and aborts it. (It could be anything, e.g. something as
simple as an AddNew without an Update.)

Using AddNew on the RecordsetClone of the form (rather than its Recordset)
might solve the problem.

In a well-designed and implemented database, Access locks the table only for
a millisecond while the new record is added. There is generally no need to
worry about locking issues.

If you do need to assign a particular value, you can do so by executing an
Append query statement in code. If the table you append to is a linked
table, you are likely to run into this bug:
http://support.microsoft.com/?id=884185
 
L

Larry Linson

Joseph;

eat a dick

if you can't rely on AutoNumbers; then you should use a REAL DATABASE,
jackass



-Larry Linson Jr
ADP Nationalist
 
P

polman

Allen thank you one more time for your reply.
I did what the link you provided implies. The problem persist. I also
tried to find out if something else is going on, without success. Even
the PgDn on the keyboard or the navigation button on the form give the
right increment (by 1) in the auto-numbered field. Only the
Me.Recordset.AddNew increases the field by 2... I tried anything that I
can think of.
If you have any suggestion please share it with me.

Ï/Ç Allen Browne Ýãñáøå:
 
B

BruceM

You are no longer using the version of your name that appears in the e-mail
address, and are instead impersonating a valued contributor to this forum,
which is contemptible behavior at best. You have gone from being annoying
to engaging in something that may well be illegal. You would be doing
everybody including yourself a favor if you disappear from this forum and
never return.

Larry Linson said:
Joseph;

eat a dick

if you can't rely on AutoNumbers; then you should use a REAL DATABASE,
jackass



-Larry Linson Jr
ADP Nationalist
 
A

aaron.kempf

Bruce;

Im not impersonating anyone.
I'm just saying that I wish I was Larry Linson Jr.

Because if I was, I would convince my old fogey papa to give up the
programmers license because he is 'stuck in the 90s'

-Aaron



You are no longer using the version of your name that appears in the e-mail
address, and are instead impersonating a valued contributor to this forum,
which is contemptible behavior at best. You have gone from being annoying
to engaging in something that may well be illegal. You would be doing
everybody including yourself a favor if you disappear from this forum and
never return.
 
A

aaron.kempf

if your database can't reliably make autonumbers-- then use a better
database

if your database doesn't support @@identity then use a real database

it's pretty simple math kids; MDB is too much of a PITA for real world
use

-Aaron
 

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