If you think you have a good reason for editing an
AutoNumber field, then you should not be using AutoNumber.
An AutoNumber primary key is only guaranteed to be unique
and could be any random value (even text if you use
replication). Autonumbers should never be exposed to users,
since they have no meaning beyond their use as a surrogate
key.
What I really want is a number field that increments from
the last record. There will only be one user entering in
data to this table, so not really any issues with sharing
here. What's the best way to make this type of field?
Oh, you just want an incrementing number field, not really
an AutoNumber field. In that case, I think that article is
unnecessarily complex. You don't need a query to find the
maximum value in the table, you can just use DMax instead
DLookup on a Totals query.
Instead of using the Current event, it's better to use the
form's BeforeInsert event to set the field's value:
Me.fieldname = DMax("fieldname", "table") + 1
The Insert events only fire on new records so you don't need
to check for Me.NewRecord
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.