formatting number for thousands' comma #,###,###,###

hey guys!

i'm curious. if i have 2 numbers

9999
9999999999

and i want to insert commas in the thousands position to make it more readable so it'll look like this

9,999
9,999,999,999

i know i can do Format(strEndingBalance, "#,###,###,###.00")

and apply it to both numbers.

however what if i have another number

9999999999999999999999999999999999999999999999999999999999

(ok just ignore that no variable can store that hahaha - i think!! hrmm, can any variable store that number? i feel like Ali G asking the scientists about computers if they can multiply 999999999999991099910101010999 x 9999101099998910101010!! hahaha http://www.youtube.com/watch?v=eB5VXJXxnNU)

is there a format that i can use that will apply the comma at even interval recursively or must i type out a very very very long format string like the following?



Format(strEndingBalance, "#,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###,###.00")?

haha k that's REALLY LONG!!

is there anyway i can type out Format(strEndingBalance, "#,###") and make it recursive? thanks guys!! = ))
developingprogrammerAsked:
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.

Bill RossProgrammerCommented:
Hi,

Try this Format(strEndingBalance, "Standard")

Regards,

Bill
0
als315Commented:
You should define formatting only once
Format(strEndingBalance, "#,###.00") will give you:
9,999.00
9,999,999,999.00
and so on
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
Rey Obrero (Capricorn1)Commented:
use

FormatNumber(strEndingBalance,2)   '2 is for two decimal place
0
developingprogrammerAuthor Commented:
whao guys, fantastic!! i didn't know about "Standard", i didn't know that #,### would repeat and definitely didn't know about the esoteric function FormatNumber!! haha great!! = )

in the end i decided to use

Format(CCur(varEndingBalance), """Credit:"" #,###.00;""Debit:"" #,###.00")

because that gave more control over the prefixes.

but thanks guys for all your help, appreciate it!! = ))
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.