New database

  • Thread starter Thread starter snub
  • Start date Start date
S

snub

I am completely new to Access and databases in general. I am creating a new
table, the first field of which needs to be an AutoNumber, but it needs to
start at 10001; eg first AutoNumber generated 10001, second 10002, third
10003 etc. Can someone help?
 
Autonumbers won't do that. An autonumber field picks a unique number, if the
field is also the primary key field. Autonumber need not pick a sequential
number.

What you will probably need to do is to use the DMax + 1 function to look at
the existing highest number in the field and add one to it. There are two
problems with this:

(1) It only works in forms. If someone inputs directly into the table, it
will not work.

(2) In a multi-user environment, it's possible for two or more people to
pick the same number if they are adding a new record at the same time.

Unfortunately Access doesn't support sequences at table level like other
major league databases such as Oracle or SQL Server.
 
You've already received responses pointing out that Access Autonumbers are
not intended for that use.

If you'll describe what you want to accomplish (rather than, as you've done,
"how" you want to do something), folks here may be able to offer alternate
approaches. After all, if you're 'new', folks here may have already solved
the problem you're facing ... if we only knew what it was!<g>

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 psuedocode 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.
 
Hi, thanks for the replies.
I am trying to create a field, first field, in a table that starts at 10001
and increments itself by one each time data is added, this field will be
hidden to the users of the database once it is in use; that's why I assumed
it would be an auto number.
 
You are still describing "how" ... a hidden field that starts at xxxx and
increments by one for each record.

Why? What will having that allow you to do?

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 psuedocode 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.
 
Back
Top