473,325 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Add leading Zeros to number

Hello,

I have a number that is 6 places long.

I would like:

"16" to be "000016"
"116" to be "000116"

and so on.

Any help whould be great!!

Thanks,

Jack
Nov 20 '05 #1
5 66500
Number.ToString.PadLeft(6, "0"c)

"jack" <ja**@mrolinux.com> wrote in message
news:eG*************@tk2msftngp13.phx.gbl...
Hello,

I have a number that is 6 places long.

I would like:

"16" to be "000016"
"116" to be "000116"

and so on.

Any help whould be great!!

Thanks,

Jack

Nov 20 '05 #2
Hello,

Thanks for the quick reply. How do I have the formating done on a var like
CounterCount?

Thanks,

Jack

"Mark Keogh" <no@email.com.au> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Number.ToString.PadLeft(6, "0"c)

"jack" <ja**@mrolinux.com> wrote in message
news:eG*************@tk2msftngp13.phx.gbl...
Hello,

I have a number that is 6 places long.

I would like:

"16" to be "000016"
"116" to be "000116"

and so on.

Any help whould be great!!

Thanks,

Jack


Nov 20 '05 #3
Exactly the same,

CounterCount.ToString.PadLeft(6, "0"c)

HTH
"jack" <ja**@mrolinux.com> wrote in message
news:#S**************@TK2MSFTNGP11.phx.gbl...
Hello,

Thanks for the quick reply. How do I have the formating done on a var like CounterCount?

Thanks,

Jack

"Mark Keogh" <no@email.com.au> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Number.ToString.PadLeft(6, "0"c)

"jack" <ja**@mrolinux.com> wrote in message
news:eG*************@tk2msftngp13.phx.gbl...
Hello,

I have a number that is 6 places long.

I would like:

"16" to be "000016"
"116" to be "000116"

and so on.

Any help whould be great!!

Thanks,

Jack



Nov 20 '05 #4
Thanks!!!

"Mark Keogh" <no@email.com.au> wrote in message
news:eq**************@TK2MSFTNGP11.phx.gbl...
Exactly the same,

CounterCount.ToString.PadLeft(6, "0"c)

HTH
"jack" <ja**@mrolinux.com> wrote in message
news:#S**************@TK2MSFTNGP11.phx.gbl...
Hello,

Thanks for the quick reply. How do I have the formating done on a var

like
CounterCount?

Thanks,

Jack

"Mark Keogh" <no@email.com.au> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Number.ToString.PadLeft(6, "0"c)

"jack" <ja**@mrolinux.com> wrote in message
news:eG*************@tk2msftngp13.phx.gbl...
> Hello,
>
> I have a number that is 6 places long.
>
> I would like:
>
> "16" to be "000016"
> "116" to be "000116"
>
> and so on.
>
> Any help whould be great!!
>
> Thanks,
>
> Jack
>
>



Nov 20 '05 #5
Hello,

"jack" <ja**@mrolinux.com> schrieb:
I have a number that is 6 places long.

I would like:

"16" to be "000016"
"116" to be "000116"

and so on.

Any help whould be great!!


\\\
MsgBox(Format(16, "000000"))
///

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: TheTeapot | last post by:
Hi all, Here's a puzzle: // Say I have an array of numbers set up like so: $arr = array(15,16,17,100,121,1000); // How can I create a function so that I can use it like so:...
5
by: samik_tanik | last post by:
I need to export a datagrid to Excel. I could did this. But, also need to keep the leading zeros in the data. How can I acheive this? Any help would be appreciated. -- Thanking you in...
1
by: mmmgood1 | last post by:
Help, I'm linking an excel spreadsheet in access and I have datafields with leading zeros (01021). When the file is linked in access, I get a #num in the field with the leading zeros. The zeros...
5
by: OneDay | last post by:
I've got a field that has some old data with text in it, but all forward data will be a 3 digit number. But many of the numbers are still only 2 digits. I would like to force the leading zero in...
2
by: chris | last post by:
Hi, I have a simple ms access application that allows you to scan barcodes in to a form which stores them in the database. The barcodes are 6 digits in length e.g. 555666 but my handheld...
3
by: brad.goldberg | last post by:
Hey All, I know this has been addressed in a few different conversations but none are exactly what I am trying to do, bear with me I am an access Newbie. Basically I have a form that assigns...
6
by: JimmyKoolPantz | last post by:
Task: Customer wants a script of the data that was processed in a "CSV" file. Problem: Zip-Code leading zeros are dropped Basically we have a client that has requested a custom script for...
1
by: rawlund | last post by:
Am queying table using this statement select max(SUBSTRING (policyno,11,6)) as policyno from table where substring(policyno,5,3) = 070 The statement works but it does not return the maximum...
5
n8kindt
by: n8kindt | last post by:
First of all, i haven't been to this site in a while and WOW is it much improved. I love all the new stuff--it looks great! I am all but done building a simple Point of Sale system through...
15
by: Deekay | last post by:
Is there a way to preserve possible leading zeros in a number even when it is passed as text? I have this code on a form which runs off a command button taking two values from user input, passing...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.