Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 14th, 2006, 11:45 AM
Ntl News Group
Guest
 
Posts: n/a
Default 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?
  #2  
Old November 14th, 2006, 11:55 AM
Rick Brandt
Guest
 
Posts: n/a
Default Re: Format Number with thousands comma but no decimal places

Ntl News Group wrote:
Quote:
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


  #3  
Old November 14th, 2006, 12:05 PM
Ntl News Group
Guest
 
Posts: n/a
Default Re: Format Number with thousands comma but no decimal places

Rick Brandt wrote:
Quote:
Ntl News Group wrote:
Quote:
>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], "#,###")
>

Quote:
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.
  #4  
Old November 14th, 2006, 12:25 PM
Kc-Mass
Guest
 
Posts: n/a
Default Re: Format Number with thousands comma but no decimal places

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" <ian.sexton@ntlworld.comwrote in message
news:Hgi6h.30744$TH3.7123@newsfe2-gui.ntli.net...
Quote:
>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?

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles