Mail Merge using trim on an If. . . then function

I have created a mail merge that uses If. . . then to determine if some information should be displayed or not.  This is great but if the condition is not true then I have left the command "".  The problem with this is that the information is being displayed in a table and therefore I end up with blank rows.  I would like to remove these blank rows.  I am hoping that there is some kind of Trim function within Word that I can use.
At the moment the commands look like this:
{IF { MERGEFIELD Qty}>0 " {MERGEFIELD QTY} copies - VAT zero rate)" ""}
{IF { MERGEFIELD Inside_Cover } >0  "Print cover cost - (VAT zero rate)" ""}

Does anyone know if what I want is possible?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I would think that any Trim function (which in VB removes spaces from each end of a string) would still leave an empty string, and hence an empty row.
The SKIPIF field might suit you.
merciaAuthor Commented:
Thanks. SKPIF is new to me, I will try it, if you was to apply it to {IF { MERGEFIELD Qty}>0 " {MERGEFIELD QTY} copies - VAT zero rate)" ""} where would you put it?  At the begining of the IF or before it?
It's ages since I last used it (Word 6, probably) but I would do something like this, with the emphasis on something.
{SkipIF { MERGEFIELD Qty}=0 } { "{MERGEFIELD QTY} copies - VAT zero rate)" }
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

merciaAuthor Commented:
Thanks for the advice, but it did not work is SkipIf used to skip the record or line?  I am now think that it might be n idea to not put each If on a new line and if the condition is found to be true then carridge return then type my text?  In your SkipIF you have the Else part outside the brackets is the deliberate?  I am trying to look up skipif to see its uses.  What do you think about the carridge return idea?
It was deliberate, but perhps not well informed. However, the logic was that records with the skip condition met just wouln't be seen in the output at all, so that further nesting would not be necessary.

I'll try to find to to do some tests to remind me exactly how it should work, but it may be a while and you might find the answer before me.
merciaAuthor Commented:
Thanks for your help, I have tested ideas all afternoon, but with no joy so all help is appreciated.
Yes. I was careless There isn't any need for a false part.

I've just tested it against a potentially blank field.
I seems to work OK wherever it is positioned.

{ SkipIf <<  Field1 >> = "" } << Field1 >> << Field2 >>
It will cause omission of the whole record. I'm not sure if that is what you need.
merciaAuthor Commented:
Thanks for the code, but I am looking for Word to not print that line and therefore move itself up.  The best way to describe is like mail merge lables.  When you produce lables and use merge fileds you may have 3 lines for the address { Addr1 }{ Addr2 }{ Addr3 }. If these are placed on the lable in the following format:

{ Addr1 }
{ Addr2 }
{ Addr3 }

If { Addr2 } contains a null then the line is not printed.  You will not end up with an address like:

{ Addr1 }

{ Addr3 }

It will look like

{ Addr1 }
{ Addr3 }
Do you understand what I mean?  I would therefore like to do the same with the If. . . then merged fields.  Hope this makes sense.
In Word 2000, there is an opportunity on the 'Merge' dialogue to choose between printing and not printing blank lines.
In Word 2003, this dialogue is not used in the guided process, but the property (SupressBlankLines) is set by default.

What Version of Word are you using and how are you with VBA?
I see that you've done some programming. This property should be true

merciaAuthor Commented:
That is sounding like the answer I will give it a go.  I am guessing that I would apply this to the master document under Document_New, is that correct?

Thanks for all your help.
I'm not sure that's right.

The property should be set on the Main document and should only need doing once, and would be saved if the Main document is saved

The usual system for MailMerge is to reuse the Main document, so there is no Document_New Event, which fires when a new document is made from the template.

If you have a template from which you create a new Main document for each run, then you could well put it there.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
merciaAuthor Commented:
Thats fine, I agree GrahamSkan has assited me and deserves the points.  Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.