Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2005

Tip: Looking for answers? Try searching our database.

Zero Values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sue - 18 Oct 2005 18:00 GMT
This was a previous post of mine.  I came back to this issue and want to make
sure that my post is seen.  I'm trying to hide zero values in a form field
calculation.

I've done what was suggested below, and the $0.00 display is gone now, but
now
it's not calculating the fields.  This is what I've used:
{=Trans1+Hotel1+Meals1+Car1+Misc1 \# $,0.00;-$,0.00;}
Do I have to format the fields used in the calculation any certain way?  
Right now they
are formatted as 0.00.

Thanks!

"macropod" wrote:

> Hi Sue,
>
> You don't need any vba for this. Instead, you can code the calculation field
> as:
> {=BkMrk1-BkMrk2 \# $,0.00;-$,0.00;}
> where BkMrk1 and BkMrk2 are the bookmark names of your formfields.
>
> The numeric picture switch (ie '\# $,0.00;-$,0.00;') tells Word how to
> display +ve;-ve;0 values. In this case, +ve and -ve values are displayed as
> dollars and cents, with a thousands separator. By leaving the third
> parameter (ie whatever follows the second semi-colon) empty, you can make
> Word display nothing when the result of your calculation is zero.
>
> For more information on Word Field Maths, see my 'tutorial' at:
> http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=365442
>
> Cheers
>
> "Sue" <Sue@discussions.microsoft.com> wrote in message
> news:991C6D5B-D4AA-4220-BDB6-FF8A780008A6@microsoft.com...
> > I've tried that, but it displays "0".  I want to display the calculation
> as
> > currency unless it's a zero value.  I don't want to display anything if
> > there's nothing in the calculated fields.
> >
> > I'm not getting something here.
> > :(
> >
> > "Tony Jollans" wrote:
> >
> > > You can use number formatting pictures, but .. don't do it through the
> > > dialog.
> > >
> > > In the Form Field Options Dialog for the field, make sure Text Format is
> > > empty - and close the dialog
> > >
> > > Press Alt+F9 to see the field codes in  the document.
> > > The calculated field will look something like this:
> > >
> > > { FORMTEXT { =Firstnum+Secondnum } }
> > >
> > > where the bit inside the internal field is your calculation.
> > > Add "\# #" after the calculation but before the closing brace so it
> looks
> > > like ...
> > >
> > > { FORMTEXT { =Firstnum+Secondnum \# #} }
> > >
> > > Press Alt+F9 to hide the field codes and it should then behave as you
> want.
> > >
> > > --
> > > Enjoy,
> > > Tony
> > >
> > > "Sue" <Sue@discussions.microsoft.com> wrote in message
> > > news:F0B82F8B-0D61-4CDC-AC47-97A12D85BC23@microsoft.com...
> > > > How to I "hide" zero values in form fields?  I want the users to have
> the
> > > > option to print a blank form without "0" displaying in the calculation
> > > fields.
> > > >
> > > > Thanks!
Tony Jollans - 18 Oct 2005 18:41 GMT
You do have them all set to Calculate on Exit, don't you?

--
Enjoy,
Tony

> This was a previous post of mine.  I came back to this issue and want to make
> sure that my post is seen.  I'm trying to hide zero values in a form field
[quoted text clipped - 71 lines]
> > > > >
> > > > > Thanks!
Sue - 18 Oct 2005 20:40 GMT
Yes I do.  I just don't get it.  There has to be something simple I'm not
doing here.  The calculation works fine until I put in the format switch to
not display Zero values, then nothing calculates.  My calculation is  
{=Trans1+Hotel1+Meals1+Car1+Misc1 \# $,0.00;-$,0.00;}.  If I do a simple
=Trans1+Hotel1+Meals1+Car1+Misc1 it works, but displays $0.00 when there's no
data.

> You do have them all set to Calculate on Exit, don't you?
>
[quoted text clipped - 88 lines]
> > > > > >
> > > > > > Thanks!
Tony Jollans - 18 Oct 2005 21:05 GMT
I just set up a form with 5 formfields with the same names as yours and then
added a calculated field and cut and pasted the field code from your post
and it all worked fine for me, so I'm not sure what may be the problem.

However, I don't get $0.00 without the switch - just plain zero - just
realised what's probably wrong. Do you have a format set via the formfield
options dialog as well as the format switch - if so, remove it.

--
Enjoy,
Tony

> Yes I do.  I just don't get it.  There has to be something simple I'm not
> doing here.  The calculation works fine until I put in the format switch to
[quoted text clipped - 95 lines]
> > > > > > >
> > > > > > > Thanks!
Sue - 18 Oct 2005 21:20 GMT
It WORKS!  Thank you SO MUCH Tony!  This was driving me up a wall!  I
actually have 3 forms to apply this to now.  I'm thrilled.  Thanks again!

> I just set up a form with 5 formfields with the same names as yours and then
> added a calculated field and cut and pasted the field code from your post
[quoted text clipped - 121 lines]
> > > > > > > >
> > > > > > > > Thanks!
Tony Jollans - 18 Oct 2005 23:03 GMT
Glad you're sorted.

I have never found anything official about this but it appears that using
any format in the dialog (other than those lsited in the dropdown, anyway)
is a bit unpredictable, and especially so if combined with a format on the
formtext field.

What I think may happen is that Word attempts to apply the second format to
the results of the first format but fails as it is not numeric any more.

--
Enjoy,
Tony

> It WORKS!  Thank you SO MUCH Tony!  This was driving me up a wall!  I
> actually have 3 forms to apply this to now.  I'm thrilled.  Thanks again!
[quoted text clipped - 124 lines]
> > > > > > > > >
> > > > > > > > > Thanks!
Jean-Guy Marcil - 18 Oct 2005 21:25 GMT
Sue was telling us:
Sue nous racontait que :

> Yes I do.  I just don't get it.  There has to be something simple I'm
> not doing here.  The calculation works fine until I put in the format
> switch to not display Zero values, then nothing calculates.  My
> calculation is {=Trans1+Hotel1+Meals1+Car1+Misc1 \# $,0.00;-$,0.00;}.
> If I do a simple =Trans1+Hotel1+Meals1+Car1+Misc1 it works, but
> displays $0.00 when there's no data.

{=Trans1+Hotel1+Meals1+Car1+Misc1 \# $,0.00;-$,0.00;}

Why the "," between the ? and the 0?
Make sure there is a space after the last ";".

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Tony Jollans - 18 Oct 2005 22:53 GMT
Hi Jean-Guy,

The comma makes, for example 1234 display as $1,234.00 instead of just
$1234.00 (and I have never found spaces necessary in fields except as
delimiters).

--
Enjoy,
Tony

> Sue was telling us:
> Sue nous racontait que :
[quoted text clipped - 17 lines]
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
Jean-Guy Marcil - 18 Oct 2005 23:30 GMT
Tony Jollans was telling us:
Tony Jollans nous racontait que :

> Hi Jean-Guy,
>
> The comma makes, for example 1234 display as $1,234.00 instead of just
> $1234.00 (and I have never found spaces necessary in fields except as
> delimiters).

Oh, yeah, forgot about the thousand separator.... On my machine it is the
non-breaking space (I work with French language customers).

As for the space, I have found that very often (depending on the field and
the switch you add), if you do not have a space between the end of the
switch and the closing }in a field, then you get a Syntax error message. In
this case, this is what I get, it may be my machine that is quirky!

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.