Microsoft Access AutoNumber

20 pts.
Tags:
AutoNumber
Database programming
Microsoft Access
Microsoft Access auto increment
VBA
Hi , I want to add a row of serial number for the existing records in MS access .Whenever I am trying to define a new row with type as "Auto Number" and save the same it automatically gets changed to Text type.Please suggest.Also, the requirement is modified and now the serial number has to be of 8 digits i.e. the first number should be 00000001 and the max length should be of 8 digits as this field is being received by an external system and this system will accept only 8 digits .Is it possible to do in MS access and how can I do the same. I am allowed to use VB as well,so can anyone please let me know how it can be done through any of these. Thanks, Ansh
ASKED: February 25, 2009  12:01 PM
UPDATED: February 25, 2009  5:00 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi Ansh,

The only way I know how to do this in Access is to create a text field with an input mask of 00000000. Which would require any entry to be all numbers and have at least 8 digits. Now you would have to write code to fill in this information for Access’s autonumber can’t do it for you. One option is when they are entering new data, use the after insert and insert into the serial number field the last serial number in the table plus one. I.E. serialnumber = dlast(“serialnumber”,”table1″)+1

Dustin

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following