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 / Mailmerge and Fax / April 2005

Tip: Looking for answers? Try searching our database.

Do not show data if zero Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pas926 - 02 Apr 2005 00:41 GMT
I have a mail merge that I added the IF Then statement to a field so that if
the value is zero, it doesn't show up on the document, however it does take
up a space that I have to remove from the document.  I don't want that space,
is there a way to get rid of it.
Thanks any help is appreciated.
Paul
Peter Jamieson - 02 Apr 2005 08:22 GMT
Are you absolutely sure that your IF field does not introduce any space?
E.g. if you have used

{ IF { MERGEFIELD myfield } = "0" " " "{ MERGEFIELD myfield }" }

then you will see a space, any you need to use

{ IF { MERGEFIELD myfield } = "0" "" "{ MERGEFIELD myfield }" }

Or maybe you mean that it uses an additional /line/ (i.e. paragrapgh) in
which case you can try putting the paragraph inside the IF results.

e.g. if you want

preceding text
number
follwing text

when there is a number and

preceding text
follwing text

when there is not, try

preceding text{ IF { MERGEFIELD myfield } = "0" " " "
{ MERGEFIELD myfield }" }
following text

Otherwise, can you post the exact contents of the IF field here please?

Peter Jamieson

>I have a mail merge that I added the IF Then statement to a field so that
>if
[quoted text clipped - 5 lines]
> Thanks any help is appreciated.
> Paul
pas926 - 06 Apr 2005 04:01 GMT
Actually I want to get rid of the line that the code exists on if the result
is zero. When the merge is done and if code line LPI is zero it will take up
a line in the document that I have to erase.  There are about 30 lines of
code.  If I don't put the code on different lines then the formatting will be
off.
Here's some of my code:

{IF {Mergefield LPI}<>0 "Labwork Principal"        {TypeLab 6/3}    {LPI} "
"""}
{IF {Mergefield LSI}<>0 "Labwork Supervisor"      {TypeLab 6/2}    {LSI} "
"""}
{IF {Mergefield LAI}<>0 "Labwork Archaeologist"   {TypeLab 6}    {LAI} " """}

Thanks again in advance.
Paul

> Are you absolutely sure that your IF field does not introduce any space?
> E.g. if you have used
[quoted text clipped - 38 lines]
> > Thanks any help is appreciated.
> > Paul
Peter Jamieson - 06 Apr 2005 16:39 GMT
Can you use

{ IF { MERGEFIELD LPI } <> 0 "Labwork Principal    {TypeLab 6/3}    {LPI}
" "" }{ IF { MERGEFIELD LSI } <> 0 "Labwork Supervisor    {TypeLab 6/2}
{LSI}
" "" }

etc., i.e. where the necessary paragraph mark is inserted as part of your
non-blank result?

Peter Jamieson

> Actually I want to get rid of the line that the code exists on if the
> result
[quoted text clipped - 60 lines]
>> > Thanks any help is appreciated.
>> > Paul
pas926 - 08 Apr 2005 00:35 GMT
Thanks Peter,
  Have tried that but it messes up my  formatting more .  Thanks for  your
input, very much appreciated.  Paul

> Can you use
>
[quoted text clipped - 72 lines]
> >> > Thanks any help is appreciated.
> >> > Paul
Peter Jamieson - 08 Apr 2005 11:13 GMT
OK, what goes wrong with the formatting when you do that? Is it to do with
horizontal layout (e.g. tabs), vertical layout (e.g. paragraph spacing) or
something else? If you define a paragraph style with the correct tabs etc.
and apply it to all the IF statements, does it make any difference.?

The only other reasonably simple way I can think of to solve this is to
create the data source you need, which may be possible if for example you
are using Access and are in a position to create your own queries, or if you
can issue the necessary SQL using Word VBA OpenDataSource. I'm not sure
exactly what might work in this case because tabs embedded in the SQL field
may not behave as you want, but for example you could try

SELECT lpi, iif(mytable.lpi = 0,'','Labwork Principal') AS `lpitext1` FROM
mytable

Then use

{ MERGEFIELD lpitext }{ IF { MERGEFIELD LPI } <> 0 "    { TypeLab 6/3 }
{LPI}" "" }

in this case when LPI is 0 the IF statement should insert nothing, lpitext
should be blank, and so Word should suppress the line.

Peter Jamieson

> Thanks Peter,
>   Have tried that but it messes up my  formatting more .  Thanks for  your
[quoted text clipped - 87 lines]
>> >> > Thanks any help is appreciated.
>> >> > Paul
Graham Mayor - 02 Apr 2005 09:01 GMT
You can suppress zero with a field switch
http://www.gmayor.com/formatting_word_fields.htm

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> I have a mail merge that I added the IF Then statement to a field so
> that if the value is zero, it doesn't show up on the document,
> however it does take up a space that I have to remove from the
> document.  I don't want that space, is there a way to get rid of it.
> Thanks any help is appreciated.
> Paul

Rate this thread:






 
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.