Autonumbers

  • Thread starter injanib via AccessMonster.com
  • Start date
I

injanib via AccessMonster.com

Hi,

I like to have my form creat a unique number for each record, which I can use
as an id number for that record later. Using autonumber works fine except
that I like the autonumber to have 6 digits so that I can print it in barcode
font and be able to scan it. Any idea how I can get the auto number to start
at 100000? or display in 000001 format?

thanks folks.
 
J

Jeff Boyce

The Microsoft Access Autonumber is designed to be used as a unique row
identifier, but is not well-suited to use as a recordID that human would
need to see.

If you need a unique record identifier that YOU set, look up "Custom
Autonumber" in Access HELP or on-line for ways to do this.

That said, if you are willing to live with the idiosynchrasies you'll see
with Autonumber, take a look at using the Format property on that field in
your table definition.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I

injanib via AccessMonster.com

Can I use a macro to generate such number for me?
Jeff said:
The Microsoft Access Autonumber is designed to be used as a unique row
identifier, but is not well-suited to use as a recordID that human would
need to see.

If you need a unique record identifier that YOU set, look up "Custom
Autonumber" in Access HELP or on-line for ways to do this.

That said, if you are willing to live with the idiosynchrasies you'll see
with Autonumber, take a look at using the Format property on that field in
your table definition.

Regards

Jeff Boyce
Microsoft Office/Access MVP
[quoted text clipped - 8 lines]
thanks folks.
 
G

Guest

The code below will increment the record number value by one when creating a
new record. You will have to create the first record number manually to get a
starting point. You can, of course, change the increment interval.

Me![txtRecordNumber] = Format(DMax("[RecordNumber]", "[tblSomeTable]") + 1,
"000000")

I usually lock the RecordNumber Field and set the TabStop Property to NO for
user convenience. Then place the code in the AfterUpdate Event of the first
field the user is likely to capture.

injanib via AccessMonster.com said:
Can I use a macro to generate such number for me?
Jeff said:
The Microsoft Access Autonumber is designed to be used as a unique row
identifier, but is not well-suited to use as a recordID that human would
need to see.

If you need a unique record identifier that YOU set, look up "Custom
Autonumber" in Access HELP or on-line for ways to do this.

That said, if you are willing to live with the idiosynchrasies you'll see
with Autonumber, take a look at using the Format property on that field in
your table definition.

Regards

Jeff Boyce
Microsoft Office/Access MVP
[quoted text clipped - 8 lines]
thanks folks.
 
I

injanib via AccessMonster.com

Ok, at first it seemed easy, but when I tried I failed. the problem is that I
can't set the first record id. Lets say I want to start at 000001. as soon as
I enter this number it will change it to 1.
Just to make sure, The field type must be set as number, right?

and what is "000000" at the end of your code supposed to do?

Thanks for your response

Tom said:
The code below will increment the record number value by one when creating a
new record. You will have to create the first record number manually to get a
starting point. You can, of course, change the increment interval.

Me![txtRecordNumber] = Format(DMax("[RecordNumber]", "[tblSomeTable]") + 1,
"000000")

I usually lock the RecordNumber Field and set the TabStop Property to NO for
user convenience. Then place the code in the AfterUpdate Event of the first
field the user is likely to capture.
Can I use a macro to generate such number for me?
The Microsoft Access Autonumber is designed to be used as a unique row [quoted text clipped - 18 lines]

thanks folks.
 
G

Guest

The field type set at the table should be Number, Long Integer.
The "000000" is for a six digit format, which I understood from the original
post is what you need.

If this is not working for you, consider starting your numbering at 100 001


injanib via AccessMonster.com said:
Ok, at first it seemed easy, but when I tried I failed. the problem is that I
can't set the first record id. Lets say I want to start at 000001. as soon as
I enter this number it will change it to 1.
Just to make sure, The field type must be set as number, right?

and what is "000000" at the end of your code supposed to do?

Thanks for your response

Tom said:
The code below will increment the record number value by one when creating a
new record. You will have to create the first record number manually to get a
starting point. You can, of course, change the increment interval.

Me![txtRecordNumber] = Format(DMax("[RecordNumber]", "[tblSomeTable]") + 1,
"000000")

I usually lock the RecordNumber Field and set the TabStop Property to NO for
user convenience. Then place the code in the AfterUpdate Event of the first
field the user is likely to capture.
Can I use a macro to generate such number for me?
The Microsoft Access Autonumber is designed to be used as a unique row
[quoted text clipped - 18 lines]
thanks folks.
 

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