Format a number in a text field??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a text field that has numbers if applicable and text (N/D) if not. If
there are numbers they could range from 100 to 10,000. If the number is
1,000 or greater, I want to add the comma....but no comma if it is just a
3-digit number or text.

I got it to ALWAYS put a comma, but I can't figure out how to only put one
for a 4 or 5 digit number and nothing else. Can someone please tell me how
to accomplish this?

Thanks!
Susan
 
What you are wanting to do is a bad idea. It wastes disk space and increases
processing time. If the text will always be N/D and the numbers are always
integers, then I would suggest you keep the field as a Long Interger type and
if there is no number, leave it Null. Then when you have to present it to a
user on a form or in a report:
=Nz(Format([SomeField], "#,##0", "N/D"))
The above will return N/D if the field is Null and the number formatted like
you want it if it is not Null.

It is a common mistake to want to format numbers in a table. How you carry
data in a table should be determined by considering disk space and processing
time. The formatting of data should only occur when it is presented to a
user.

With that said, If you insist on doing it incorrectly, the same Format
function can be used to put the numberic data in a text field.
Format(MyNumber, "#,##0")
 
Susan said:
I have a text field that has numbers if applicable and text (N/D) if not. If
there are numbers they could range from 100 to 10,000. If the number is
1,000 or greater, I want to add the comma....but no comma if it is just a
3-digit number or text.

I got it to ALWAYS put a comma, but I can't figure out how to only put one
for a 4 or 5 digit number and nothing else. Can someone please tell me how
to accomplish this?

Thanks!
Susan


=====================================================
FULL LEGAL SOFTWARE !!!
Games, video, program, image, chat, questbook, catalog site, arts, news,
and...
This site it is full register and legal software !!!
Please download and you must register software !!!

PLEASE REGISTER SOFTWARE:
http://www.webteam.gsi.pl/rejestracja.htm
DOWNLOAD LEGAL SOFTWARE:
http://www.webteam.gsi.pl

Full question and post: http://www.webteam.gsi.pl

Contact and service and advanced technology:
http://www.webteam.gsi.pl/kontakt.htm
FAQ: http://www.webteam.gsi.pl/naj_czesciej_zadawane_pytania.htm

Please add me URL for you all site and search engines and best friends !!!

Me site:
SERWIS WEBNETI: http://www.webneti.gsi.pl
PORTAL WEBTEAM: http://www.webteam.gsi.pl
LANGUAGE: http://www.webneti.cjb.net
==========================================================
 
Back
Top