473,320 Members | 2,180 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,320 software developers and data experts.

Format Number with thousands comma but no decimal places

I have a text box that contains the number 1234, I want the value form
the text box to display in a second text box so I used:
[NewTextBox]=[OldTextBox]

The problems is that this displays 1234 and I want it to display 1,234
using a comma for the thousands and no decimal places.

I changed the format on the second text box to:
[NewTextBox]=Format([OldTextBox],”Standard”)

Now is displays 1,234.00. I don’t want the 2 decimal places, I just want
1,234

I then tried:
[NewTextBox]=int(Format([OldTextBox],”Standard”))
which displays 1234 with no comma for the thousands.

Can anyone show me how to force the result of 1,234 with a comma but
without any decimal places please?
Nov 14 '06 #1
3 76399
Ntl News Group wrote:
I have a text box that contains the number 1234, I want the value form
the text box to display in a second text box so I used:
[NewTextBox]=[OldTextBox]

The problems is that this displays 1234 and I want it to display 1,234
using a comma for the thousands and no decimal places.

I changed the format on the second text box to:
[NewTextBox]=Format([OldTextBox],”Standard”)

Now is displays 1,234.00. I don’t want the 2 decimal places, I just
want 1,234

I then tried:
[NewTextBox]=int(Format([OldTextBox],”Standard”))
which displays 1234 with no comma for the thousands.

Can anyone show me how to force the result of 1,234 with a comma but
without any decimal places please?
You are not limited to the "named" formats like General, Standard. etc.. You
can also explicitly define the format you want like this...

=Format([OldTextBox], "#,###")

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Nov 14 '06 #2
Rick Brandt wrote:
Ntl News Group wrote:
>I have a text box that contains the number 1234, I want the value form
the text box to display in a second text box so I used:
[NewTextBox]=[OldTextBox]

The problems is that this displays 1234 and I want it to display 1,234
using a comma for the thousands and no decimal places.

I changed the format on the second text box to:
[NewTextBox]=Format([OldTextBox],”Standard”)

Now is displays 1,234.00. I don’t want the 2 decimal places, I just
want 1,234

I then tried:
[NewTextBox]=int(Format([OldTextBox],”Standard”))
which displays 1234 with no comma for the thousands.

Can anyone show me how to force the result of 1,234 with a comma but
without any decimal places please?

You are not limited to the "named" formats like General, Standard. etc.. You
can also explicitly define the format you want like this...

=Format([OldTextBox], "#,###")

Thanks very much, isn’t knowledge a wonderful thing? I tried many different approaches before bothering people on the news group, your answer works perfectly and has saved me a lot of time, thanks again.
Nov 14 '06 #3
Set the newtxtbox equal to the oldtxtbox

In the format tab of the newtxtbox, set the format to standard and the
decimals to 0.

"Ntl News Group" <ia********@ntlworld.comwrote in message
news:Hg******************@newsfe2-gui.ntli.net...
>I have a text box that contains the number 1234, I want the value form the
text box to display in a second text box so I used:
[NewTextBox]=[OldTextBox]

The problems is that this displays 1234 and I want it to display 1,234
using a comma for the thousands and no decimal places.

I changed the format on the second text box to:
[NewTextBox]=Format([OldTextBox],”Standard”)

Now is displays 1,234.00. I don’t want the 2 decimal places, I just want
1,234

I then tried:
[NewTextBox]=int(Format([OldTextBox],”Standard”))
which displays 1234 with no comma for the thousands.

Can anyone show me how to force the result of 1,234 with a comma but
without any decimal places please?

Nov 14 '06 #4

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

Similar topics

3
by: Brent Bortnick | last post by:
Does anyone know how to find out the number of decimal places a number has. I need this info so that i can round to 3 decimal places if the number has 3 decimal places or to 2 decimal places if...
1
by: Gizmo | last post by:
Hi there i was wondering if any one new to a function that rounds up a float to so many decimal places. I have a number in bytes and converting it to mb's and gb's but once its converted i need to...
3
by: Dean G | last post by:
Hi, I need to truncate a number to two decimal places without rounding. All the functions i;ve tried tend to round up the numbers. Also i cant use any string functions to limit the size because the...
29
by: Gaijinco | last post by:
Sooner or later everytime I found recreational programming challenges I stumble with how I test if a number is has decimal places differnt than 0? For example if I want to know if a number is a...
3
by: Mark | last post by:
I have a Decimal or a Double - your choice. I'd like to print the number as string with a specified number of decimal places. Let's say my number 110.5, and I'd like to capture it in a string...
3
by: Sandy | last post by:
Hello I need to have a value display in a label with two decimal places; e.g. "4" to display as "4.00 Any help will be appreciated Sandy
2
by: Andy | last post by:
Hi I'm really stuck outputting a double number to the console with three decimal places if the furthest right value is a zero. I can coutput the number 4.546 as 4.546 but then if I output...
3
by: paulquinlan100 | last post by:
Hi I have a couple of calculated fields in a report, i've set the Decimal Places property to 0 and the format to General Number, however when previewing the report it still comes up with a...
1
by: jesmi | last post by:
hi!! i want to place two fix decimal places after a digit even if there is no decimal places after a digit. for example if there is a number 5, i want output 5.00 like that. please help me. ...
1
by: Serenityquinn15 | last post by:
Hi! I have a little trouble about in truncating numbers. What i want to do is to get the two decimal places. here's the example: when i try to get the half of 20500.39 it shows like...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
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...
0
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.