473,804 Members | 2,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 76510
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********@ntl world.comwrote in message
news:Hg******** **********@news fe2-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
7095
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 the number has 2 decimal places. Any help would be great. Regards, Brent
1
11672
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 be able to do it to 2 decimal places. Thanks for any help Scott.
3
10440
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 size can vary. example, 34.56998 must be set to 34.56 thanx any help is greatly appreciated btw this is using asp vbscript *** Sent via Developersdex http://www.developersdex.com ***
29
721
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 square number (i.e. a number which square root is a positive number as 4, 9, 16 have) I do something like: int square = sqrt(number);
3
14829
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 with 3 decimal places: "110.500". How do you do this? My method below isn't working so hot. Decimal dcTotal = 110.5; string strMyString = (Decimal.Round(dcTotal, 3)).ToString(); //Do something with this string Thanks in advance!
3
28959
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
2778
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 0.220 it comes out as 0.22 and drops the zero. Also, outputting 1.000 outputs as 1. How can I format it to include the zeros?
3
33239
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 number with up to 8 decimal places! Any suggestions how to overcome this problem gratefully received! Paul
1
2582
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. thanks in advance
1
2657
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 this:10250.195 but what i want to see is 10250.19 only. another one is 20500.42, it shows like this: 10250.2 which in real, it must be 10250.21.
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10074
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5516
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2988
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.