Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strlength 1

Status
Not open for further replies.

thewishla

MIS
Jan 17, 2002
12
GB
I have a field which lists serial numbers, at the moment some are 4 digits long, some 5 etc... I would like to know how I can run a query that makes all the numbers 8 digits long please.

Thanks
 
I'm presuming you're in access as you're referring to a query - you don't need to. Just change the format of the field in the table to 00000000 - whatever values you have in there will get 0's added to the front up to a max of 8 digits.
If you are in excel, use the REPT function
=REPT("0",8-LEN(A1))&A1 where your vlaue is in A1
HTH
Geoff
 
Thewishla - you should really say which one worked - and give it a star. I'm not fishing for stars but the protocol on this site is if a post has been helpful / informative, you should give a star. It also helps others see where helpful posts have been made, even if it is not for a question they have asked and denotes useful "locaters" for good information.
Again - please don't think I'm fishing here - If Mikey's post was the one you used, give it a star, esp. as your response was
Thanks works just as I need it
which means it obviously solved your problem
Rgds
Geoff
 
Hi thewishla,

I'm pleased that your problem has been resolved but xlbo is right in what he says - the post that solved your problem should really get a star.

Cheers,[smile] mikey2nicey
"Dream, but don't quit your day job."
 
Geoff & Mikey,

I'm new to these forums also. Thanks for the protocol tip!

Geoff: I've been using Excel for many years and never ran across the REPT function. Amazing! Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top