I've looked at all the posts I could and don't see the solution.
I am aware that the format to get a BLANK when the number is 0 is:
$ #,###.00;($ #,###.00);""
But I can't, for the life of me, get it to work in the following VBA
string. I have a total field that is 0 unless there's a total. I want
the user to see BLANK if it's zero (that's how they think of it).
thanks
sara
strSQL = " SELECT tblFreightBill. FreightBillKey,
tblFreightCo.Fr eightCo, " _
& " tblFreightBill. FreightBillNum, tblFreightBill. Freight, " _
& " tblFreightBill. FreightBillDate ,
tblFreightBill. DateBillEntered ," _
& " format(tblFreig htBill.FAKAmt,
'$#,##0.00;($#, ##0.00);""";""" ' _
& " tblFreightBill. POKey " _
& " FROM tblFreightCo " _
& " INNER JOIN tblFreightBill " _
& " ON tblFreightCo.Fr eightCOKey = tblFreightBill. FreightCoKey
" _
& " WHERE tblFreightBill. POKey= " & lngPOKey & ";" 5 3868
sara wrote: I've looked at all the posts I could and don't see the solution. I am aware that the format to get a BLANK when the number is 0 is:
$ #,###.00;($ #,###.00);""
But I can't, for the life of me, get it to work in the following VBA string. I have a total field that is 0 unless there's a total. I want the user to see BLANK if it's zero (that's how they think of it).
thanks sara
strSQL = " SELECT tblFreightBill. FreightBillKey, tblFreightCo.Fr eightCo, " _ & " tblFreightBill. FreightBillNum, tblFreightBill. Freight, " _ & " tblFreightBill. FreightBillDate , tblFreightBill. DateBillEntered ," _ & " format(tblFreig htBill.FAKAmt, '$#,##0.00;($#, ##0.00);""";""" ' _ & " tblFreightBill. POKey " _ & " FROM tblFreightCo " _ & " INNER JOIN tblFreightBill " _ & " ON tblFreightCo.Fr eightCOKey = tblFreightBill. FreightCoKey " _ & " WHERE tblFreightBill. POKey= " & lngPOKey & ";"
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Zero is considered a positive number and, therefore, will be formatted
according to the format you gave for positive numbers.
You should leave the formatting to the display layer (forms & reports)
not the data retrieval layer (queries).
To substitute an empty string: Instead of using the Format() function
use an IIF() function in the display layer (the ControlSource property
of a control):
=IIf(FAKAmt=0,N ULL,FAKAmt)
NULL will display as a blank.
--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBRKLjC4echKq OuFEgEQIw5wCffv 9QI4aTSD8V9w/m+xV5T9KJxAYAoO c8
UCF/96Pq7c0YGR+vq7F LIIBe
=Mu6E
-----END PGP SIGNATURE-----
MGFoster wrote: sara wrote: I've looked at all the posts I could and don't see the solution. I am aware that the format to get a BLANK when the number is 0 is:
$ #,###.00;($ #,###.00);""
One of a few possible solutions to your problem may be just to set the
Control holding the value to Visible = False. Just Hide the control.
But don't forget to turn it back on again if >0
Just a thought
Thanks for the quick response.
I wasn't clear, I guess. I am not formatting the data in a control,
but for a list box.
Should I try to find the value, set it (as you say, 0, blank, whatever
I can figure out) in a variable and then put the variable in my strSQL
for the listbox?
Overall, my users will be totally confused if they see "0" (or $0.00),
so I want to just have the column blank.
Will that even work?
Sara
MGFoster wrote: sara wrote: I've looked at all the posts I could and don't see the solution. I am aware that the format to get a BLANK when the number is 0 is:
$ #,###.00;($ #,###.00);""
But I can't, for the life of me, get it to work in the following VBA string. I have a total field that is 0 unless there's a total. I want the user to see BLANK if it's zero (that's how they think of it).
thanks sara
strSQL = " SELECT tblFreightBill. FreightBillKey, tblFreightCo.Fr eightCo, " _ & " tblFreightBill. FreightBillNum, tblFreightBill. Freight, " _ & " tblFreightBill. FreightBillDate , tblFreightBill. DateBillEntered ," _ & " format(tblFreig htBill.FAKAmt, '$#,##0.00;($#, ##0.00);""";""" ' _ & " tblFreightBill. POKey " _ & " FROM tblFreightCo " _ & " INNER JOIN tblFreightBill " _ & " ON tblFreightCo.Fr eightCOKey = tblFreightBill. FreightCoKey " _ & " WHERE tblFreightBill. POKey= " & lngPOKey & ";"
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Zero is considered a positive number and, therefore, will be formatted according to the format you gave for positive numbers.
You should leave the formatting to the display layer (forms & reports) not the data retrieval layer (queries).
To substitute an empty string: Instead of using the Format() function use an IIF() function in the display layer (the ControlSource property of a control):
=IIf(FAKAmt=0,N ULL,FAKAmt)
NULL will display as a blank. -- MGFoster:::mgf0 0 <at> earthlink <decimal-point> net Oakland, CA (USA)
-----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv
iQA/AwUBRKLjC4echKq OuFEgEQIw5wCffv 9QI4aTSD8V9w/m+xV5T9KJxAYAoO c8 UCF/96Pq7c0YGR+vq7F LIIBe =Mu6E -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
For a ListBox RowSource you can use the IIf() function, I posted
earlier, in the query's SELECT clause:
.. . .
& " IIf(tblFreightB ill.FAKAmt=0,NU LL,FAKAmt) As Amt" & _
" tblFreightBill. POKey " _
.. . .
--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBRKLtmIechKq OuFEgEQLK+QCghF hAURchk4mFqia1v UmqjrU/MKwAoM6z
21Nr80YDawgP+Jm 13OD5gj8A
=m8h7
-----END PGP SIGNATURE-----
sara wrote: Thanks for the quick response.
I wasn't clear, I guess. I am not formatting the data in a control, but for a list box.
Should I try to find the value, set it (as you say, 0, blank, whatever I can figure out) in a variable and then put the variable in my strSQL for the listbox?
Overall, my users will be totally confused if they see "0" (or $0.00), so I want to just have the column blank.
Will that even work?
Sara
MGFoster wrote:
sara wrote:
I've looked at all the posts I could and don't see the solution. I am aware that the format to get a BLANK when the number is 0 is:
$ #,###.00;($ #,###.00);""
But I can't, for the life of me, get it to work in the following VBA string. I have a total field that is 0 unless there's a total. I want the user to see BLANK if it's zero (that's how they think of it).
thanks sara
strSQL = " SELECT tblFreightBill. FreightBillKey, tblFreightCo .FreightCo, " _ & " tblFreightBill. FreightBillNum, tblFreightBill. Freight, " _ & " tblFreightBill. FreightBillDate , tblFreightBi ll.DateBillEnte red," _ & " format(tblFreig htBill.FAKAmt, '$#,##0.00;( $#,##0.00);"""; """ ' _ & " tblFreightBill. POKey " _ & " FROM tblFreightCo " _ & " INNER JOIN tblFreightBill " _ & " ON tblFreightCo.Fr eightCOKey = tblFreightBill. FreightCoKey " _ & " WHERE tblFreightBill. POKey= " & lngPOKey & ";"
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Zero is considered a positive number and, therefore, will be formatted according to the format you gave for positive numbers.
You should leave the formatting to the display layer (forms & reports) not the data retrieval layer (queries).
To substitute an empty string: Instead of using the Format() function use an IIF() function in the display layer (the ControlSource property of a control):
=IIf(FAKAmt=0,N ULL,FAKAmt)
NULL will display as a blank. -- MGFoster:::mg f00 <at> earthlink <decimal-point> net Oakland, CA (USA)
-----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv
iQA/AwUBRKLjC4echKq OuFEgEQIw5wCffv 9QI4aTSD8V9w/m+xV5T9KJxAYAoO c8 UCF/96Pq7c0YGR+vq7F LIIBe =Mu6E -----END PGP SIGNATURE-----
PHENOMENAL!! Thanks!
Here's what I did and it works! Thanks so much. I didn't know you
could embed an If statement like this. Powerful.
Sara
.....
& " tblFreightBill. FreightBillDate , tblFreightBill. DateBillEntered ," _
& " IIf(tblFreightB ill.FAKAmt=0,NU LL,Format(FAKAm t,'$
#,###.00')) As Amt, " _
& " tblFreightBill. POKey " _
& " FROM tblFreightCo " _
.....
MGFoster wrote: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
For a ListBox RowSource you can use the IIf() function, I posted earlier, in the query's SELECT clause:
. . .
& " IIf(tblFreightB ill.FAKAmt=0,NU LL,FAKAmt) As Amt" & _ " tblFreightBill. POKey " _
. . .
-- MGFoster:::mgf0 0 <at> earthlink <decimal-point> net Oakland, CA (USA)
-----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv
iQA/AwUBRKLtmIechKq OuFEgEQLK+QCghF hAURchk4mFqia1v UmqjrU/MKwAoM6z 21Nr80YDawgP+Jm 13OD5gj8A =m8h7 -----END PGP SIGNATURE-----
sara wrote: Thanks for the quick response.
I wasn't clear, I guess. I am not formatting the data in a control, but for a list box.
Should I try to find the value, set it (as you say, 0, blank, whatever I can figure out) in a variable and then put the variable in my strSQL for the listbox?
Overall, my users will be totally confused if they see "0" (or $0.00), so I want to just have the column blank.
Will that even work?
Sara
MGFoster wrote:
sara wrote:
I've looked at all the posts I could and don't see the solution. I am aware that the format to get a BLANK when the number is 0 is:
$ #,###.00;($ #,###.00);""
But I can't, for the life of me, get it to work in the following VBA string. I have a total field that is 0 unless there's a total. I want the user to see BLANK if it's zero (that's how they think of it).
thanks sara
strSQL = " SELECT tblFreightBill. FreightBillKey, tblFreightCo .FreightCo, " _ & " tblFreightBill. FreightBillNum, tblFreightBill. Freight, " _ & " tblFreightBill. FreightBillDate , tblFreightBi ll.DateBillEnte red," _ & " format(tblFreig htBill.FAKAmt, '$#,##0.00;( $#,##0.00);"""; """ ' _ & " tblFreightBill. POKey " _ & " FROM tblFreightCo " _ & " INNER JOIN tblFreightBill " _ & " ON tblFreightCo.Fr eightCOKey = tblFreightBill. FreightCoKey " _ & " WHERE tblFreightBill. POKey= " & lngPOKey & ";"
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Zero is considered a positive number and, therefore, will be formatted according to the format you gave for positive numbers.
You should leave the formatting to the display layer (forms & reports) not the data retrieval layer (queries).
To substitute an empty string: Instead of using the Format() function use an IIF() function in the display layer (the ControlSource property of a control):
=IIf(FAKAmt=0,N ULL,FAKAmt)
NULL will display as a blank. -- MGFoster:::mg f00 <at> earthlink <decimal-point> net Oakland, CA (USA)
-----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv
iQA/AwUBRKLjC4echKq OuFEgEQIw5wCffv 9QI4aTSD8V9w/m+xV5T9KJxAYAoO c8 UCF/96Pq7c0YGR+vq7F LIIBe =Mu6E -----END PGP SIGNATURE-----
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sky Sigal |
last post by:
(PS: Cross post from microsoft.pulic.dotnet.framework.aspnet.webcontrols)
I've been looking lately for a way to keep the Properties panel for Controls
'clean'...
My goal is to keep similar public properties of a custom Control neatly tied
together -- rather than all over the IDE.
One such set of values that will rarely be changed, so should have little
priority in the IDE Properties panel, and therefore a good candidate for
|
by: Shimon Sim |
last post by:
I have a custom composite control
I have following property
|
by: Lori |
last post by:
I created an install for my program. During installation,
3 User Interface dialogs display asking for values that
will be stored in the registry. I'm not registering
anything, just storing values for database connections and
where the program can locate necessary files.
I've found that if there's a blank space in any of these
input values (ie. a path name of c:\Program Files\Data\)
that an error displays and the installation aborts. The...
|
by: Charles Law |
last post by:
I have a string similar to the following:
" MyString 40 "Hello world" all "
It contains white space that may be spaces or tabs, or a combination, and I
want to produce an array with the following elements
arr(0) = "MyString"
arr(1) = 40
arr(2) = "Hello world"
|
by: desi.american |
last post by:
I have a dynamically generates ASPX page with tables and data.
Depending on user selection, the same page can be viewed as a simple
web page (rendered in HTML) or as an excel spreadsheet.
If the user chooses to view the page as an excel sheet, I attach the
following line of code in C# in the Page_Load method.
Response.ContentType = "application/vnd.ms-excel";
All this works fine. But some of cells read nvarchar fields from a
database...
| |
by: Radu |
last post by:
Hi. I have created a service which I needed to install. Therefore I use
InstallUtil.
On my dev machine at home I login as Administrator and I have *NO*
password set.
In my first attempts with InstallUtil I tried with username =
Administrator and I left the password textboxes blank. No go - it said
An exception occurred during the Install phase.
System.ComponentModel.Win32Exception: No mapping between account names
and security IDs was...
|
by: steve |
last post by:
Hi all,
Here's some work in progress that should allow you to run a batch file as a
custom action in a VS deployment project. Yup I know you can use js or wsh,
but the target may not have either.. Essentially it's just a wrapper for the
Process class and a command interpreter.
Warning, it only partly works. I had wanted to pass in
(a) The name of the batch file (through "BatchFileName"), and
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge.
I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge.
I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |