Need to Re-set and Customize Autonumber in a Form

P

PHS

I've set up a Form where one of the fields is an Autonumber. I've attempted
to re-set the Autonumber based on the MS Access Help (create an append query
to append number from a temp table that you want to start with), but without
success. The autonumber seems to be "internal" to the form or table and I
can't get it to re-set. Suggestions?
Also, I'd like to tack the current year in front of the Autonumber for new
records created via the Form. For example, 2010-1, 2010-2, 2010-3, etc.,
where 1, 2 and 3 are the autonumbers generated. Tips?
Thanks much in advance.
 
G

golfinray

Autonumbers are not intended to be used when you need a record number.
Autonumbers do not have to be sequential. They can just be used as a key if
you don'w have any other useful key. What you might want to do is create a
sequential number with the date in front of it. Doing that in Excel would be
much faster and easier. Then import it to Access and use an update query to
insert it in your table.
 
J

Jeff Boyce

First, Access Autonumbers are intended for use as unique row identifiers.
Period. As such, they are generally unfit for human consumption.

If you want guaranteed sequential numbers, check on-line for "custom
autonumber".

If you want human-usable "numbers" that look like "2010-1", "2010-2", etc.,
be aware that these are not "numbers"! You don't do math on them, and there
are embedded characters, so they're text. Also be aware that trying to
stuff more than one fact into a single field is poor data design ... and you
appear to be trying to stuff the current year and a sequence number into one
field.

Instead, if your record includes a date/time field, you already know the
year (i.e., Year([YourDateField]), so you don't need to store it again. If
you simply add a SeqNo field and use the above (custom autonumber) approach,
you only need to use a query to concatenate, in a query:

YourCodeNumber: Year([YourDateField]) & "-" & [YourSeqNoField]

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 

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