Need To Create 8-digit field with variable starting points...

So I have an original field in Access as shown below and I need to create an 8-digit field beginning with 370.... similar to the example below:
Original Field          Eight Digit Field
544                    37000544
33                    37000033
254                    37000254

Is there a function within Access that would enable me to do this?  Thanks.  - Tom
LVL 7
tomfarrarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
You can use Format to create the string, like:

FieldString = Format(544, "37000000")

/gustav
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tomfarrarAuthor Commented:
Hi gustav - Thanks for the post.  Not sure how that translates being kind of a novice here.  Are you saying that fixes the variable length of the 544 (0r 33) field size to give me an eight-digit field like:

37000554

37000033?
0
IrogSintaCommented:
That's what the Format function does.   If you check out the documentation on the Format Function and look for User Defined Numeric Formats, you'll see that 0's are place holders for any number.  If there is no number in that place, it will show a zero.  An alpha numeric character other than zero will show up as is.  So the 37 at the beginning will always display 37 whereas the 0's may remain as zeros or get replaced with the applicable number in that one's, ten's, hundred's, etc... place.

Hence:
Format(544, "37000000")  will return 37000544
Format(33, "37000000")  will return 37000033
Format(254, "37000000")  will return  37000254
Format(123, "ABC00000")  will return  ABC00123

Ron
0
Gustav BrockCIOCommented:
Are you saying that fixes the variable length of the 544 (0r 33) field size to give me an eight-digit field ..
Yes, that what you asked for. Press Ctrl+G and check out for yourself.

That said, if you just want this for display, it would be much easier simply to apply to format 37000000 to the Format property of your textbox in your form or report.

/gustav
0
tomfarrarAuthor Commented:
I learn something new most days here at Expert Exchange.  Thanks again.  - Tom
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.