473,320 Members | 1,794 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 Function

I'm looking for a way with either Format, FormatNumber or FormatCurrency to
show a dollar amount the normal way (like 123.40). But if the value is 0, I
want it to return "". I would like to avoid using an IF statement or
calling a costum function to do this.

(I have some reports that would be clogged with a bunch of 0's and it could
be distracting for the user to read through)

Is it possible?

Thanks. -Rob T.
Nov 21 '05 #1
3 1806
Hi Rob,

How about

Console.Write ("{0:c}",amount);

?

/Ivan Belov/

"Rob T" <RT*********@DONTwalchemSPAM.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
I'm looking for a way with either Format, FormatNumber or FormatCurrency
to show a dollar amount the normal way (like 123.40). But if the value is
0, I want it to return "". I would like to avoid using an IF statement or
calling a costum function to do this.

(I have some reports that would be clogged with a bunch of 0's and it
could be distracting for the user to read through)

Is it possible?

Thanks. -Rob T.

Nov 21 '05 #2
See :
http://msdn.microsoft.com/library/de...matstrings.asp
(Custom formatting strings)
Patrice

--

"Rob T" <RT*********@DONTwalchemSPAM.com> a écrit dans le message de
news:%2***************@TK2MSFTNGP09.phx.gbl...
I'm looking for a way with either Format, FormatNumber or FormatCurrency to show a dollar amount the normal way (like 123.40). But if the value is 0, I want it to return "". I would like to avoid using an IF statement or
calling a costum function to do this.

(I have some reports that would be clogged with a bunch of 0's and it could be distracting for the user to read through)

Is it possible?

Thanks. -Rob T.

Nov 21 '05 #3
Thanks. I was hoping to do it within the format function...but this will
work fine.
"Patrice" <no****@nowhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
See :
http://msdn.microsoft.com/library/de...matstrings.asp
(Custom formatting strings)
Patrice

--

"Rob T" <RT*********@DONTwalchemSPAM.com> a écrit dans le message de
news:%2***************@TK2MSFTNGP09.phx.gbl...
I'm looking for a way with either Format, FormatNumber or FormatCurrency

to
show a dollar amount the normal way (like 123.40). But if the value is
0,

I
want it to return "". I would like to avoid using an IF statement or
calling a costum function to do this.

(I have some reports that would be clogged with a bunch of 0's and it

could
be distracting for the user to read through)

Is it possible?

Thanks. -Rob T.


Nov 21 '05 #4

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

Similar topics

3
by: Melissa | last post by:
What specifically causes the Format event of a report's section to fire? Thanks! Melissa
3
by: Jean | last post by:
Hi, I have a query that contains the following in the WHERE part of the query: WHERE....Format(IIf(nz()<>0,, IIf(nz()<>0,, IIf(nz()<>0,, ))),"0.0") AS Körperhöhe,....
6
by: Stuart McGraw | last post by:
I am looking for a VBA "format" or "template" function, that is, a function that takes a format string and a varying number of arguments, and substitutes the argument values into the format string...
13
by: Roy Hills | last post by:
I've seen two different function prototype formats used for ANSI C, and I'm unsure as to which is the correct or preferred one. 1st Format (this is what I use) type function(type, type, type);...
4
by: Matt | last post by:
I'm trying to write a shared function that will convert all my phone numbers from format 1234567890 to (123) 456-7890. Here is my function that I wrote: Public Shared Function...
10
by: KJ | last post by:
Hello, Why does this not work? txtMoney.Text.Format("#,##0.00") If I type 100 in txtMoney, it returns #,##0.00 I have never gotten the format function to work in .NET.
10
by: Ron | last post by:
Hello, The following code works in a Form class module but not a standard module: Dim d1 As DateTime Format(d1, "MMMM") In a standard module I get a squigly line saying that an argument has...
16
by: Al Reid | last post by:
First, I'm using vb2005. I have a string that is read from a barcode reader into a TextBox. The string is 6 characters long and represents a date (mmddyy). I want to display it to the user in a...
4
by: sql guy123 | last post by:
HI, I'm pretty new to MS SQL, My problem is setting .... =Format$(Date(),"mm" & "/1/" & "YYYY") (Which is from my MS ACCESS database)
11
by: shsandeep | last post by:
I used the following query to retrieve the date in dd-mon-yyyy format. db2 => SELECT RTRIM(CHAR(DAY(COVG_TYP_STRT_DT))) || '-' || RTRIM(MONTHNAME(COVG_TYP_STRT_DT)) || '-' ||...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.