Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Do not show data if zero Question
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 |
#2
|
|||
|
|||
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 "pas926" wrote in message ... 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 |
#3
|
|||
|
|||
You can suppress zero with a field switch
http://www.gmayor.com/formatting_word_fields.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org pas926 wrote: 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 |
#4
|
|||
|
|||
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 "Peter Jamieson" wrote: 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 "pas926" wrote in message ... 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 |
#5
|
|||
|
|||
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 "pas926" wrote in message ... 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 "Peter Jamieson" wrote: 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 "pas926" wrote in message ... 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 |
#6
|
|||
|
|||
Thanks Peter,
Have tried that but it messes up my formatting more . Thanks for your input, very much appreciated. Paul "Peter Jamieson" wrote: 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 "pas926" wrote in message ... 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 "Peter Jamieson" wrote: 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 "pas926" wrote in message ... 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 |
#7
|
|||
|
|||
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 "pas926" wrote in message ... Thanks Peter, Have tried that but it messes up my formatting more . Thanks for your input, very much appreciated. Paul "Peter Jamieson" wrote: 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 "pas926" wrote in message ... 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 "Peter Jamieson" wrote: 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 "pas926" wrote in message ... 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 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Specific Email Merge w/ Specific Attachements | Mailmerge | |||
Newbie question on MSWord templates and data | Microsoft Word Help | |||
Data Mess | Microsoft Word Help | |||
Word Field Codes in Excel data file | Mailmerge | |||
Merge Data Source path | Mailmerge |