Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Hello!
macropod wrote me a great statement for displaying the last 4 digits of a 16-digit account number - see below: It works great but only if there is an account number in the field. It turns out that sometimes there isn't an account number in the field and I get a syntax error. I want to use an If Then Else statement to use the code if there is an account number but leave the field blank if there isn't an account number. I'm not sure how to do it. The Help is written to display "text" or not and I'm not sure how to deal with quotes and brackets. Thanks as always for your help! ![]() (QUOTE{SET Data {MERGEFIELD myfield}}{=MOD({=INT({REF Data}/100)-1},100)+1 \ #00}} {IF{REF Data }= "*1?" 1 {IF{REF Data }= "*2?" 2 {IF{REF Data }= "*3?" 3 {IF{REF Data }= "*4?" 4 {IF{REF Data }= "*5?" 5 {IF{REF Data }= "*6?" 6 {IF{REF Data }= "*7?" 7 {IF{REF Data }= "*8?" 8 {IF{REF Data }= "*9?" 9 0}}}}}}}}} {IF{REF Data }= "*1" 1 {IF{REF Data }= "*2" 2 {IF{REF Data }= "*3" 3 {IF{REF Data }= "*4" 4 {IF{REF Data }= "*5" 5 {IF{REF Data }= "*6" 6 {IF{REF Data }= "*7" 7 {IF{REF Data }= "*8" 8 {IF{REF Data }= "*9" 9 0}}}}}}}}}} |
#2
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Use
{ IF { MERGEFIELD myfield } "" "{QUOTE{SET Data {MERGEFIELD myfield}}{=MOD({=INT({REF Data}/100)-1},100)+1 \ #00}} {IF{REF Data }= "*1?" 1 {IF{REF Data }= "*2?" 2 {IF{REF Data }= "*3?" 3 {IF{REF Data }= "*4?" 4 {IF{REF Data }= "*5?" 5 {IF{REF Data }= "*6?" 6 {IF{REF Data }= "*7?" 7 {IF{REF Data }= "*8?" 8 {IF{REF Data }= "*9?" 9 0}}}}}}}}} {IF{REF Data }= "*1" 1 {IF{REF Data }= "*2" 2 {IF{REF Data }= "*3" 3 {IF{REF Data }= "*4" 4 {IF{REF Data }= "*5" 5 {IF{REF Data }= "*6" 6 {IF{REF Data }= "*7" 7 {IF{REF Data }= "*8" 8 {IF{REF Data }= "*9" 9 0}}}}}}}}}} "" } I have assumed that you have correctly quoted the construction that Macropod gave you, though I have replaced "(" before the QUOTE with the required "{". All of the field delimiters { } must be entered by using Ctrl+F9. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Pixie" wrote in message ... Hello! macropod wrote me a great statement for displaying the last 4 digits of a 16-digit account number - see below: It works great but only if there is an account number in the field. It turns out that sometimes there isn't an account number in the field and I get a syntax error. I want to use an If Then Else statement to use the code if there is an account number but leave the field blank if there isn't an account number. I'm not sure how to do it. The Help is written to display "text" or not and I'm not sure how to deal with quotes and brackets. Thanks as always for your help! ![]() (QUOTE{SET Data {MERGEFIELD myfield}}{=MOD({=INT({REF Data}/100)-1},100)+1 \ #00}} {IF{REF Data }= "*1?" 1 {IF{REF Data }= "*2?" 2 {IF{REF Data }= "*3?" 3 {IF{REF Data }= "*4?" 4 {IF{REF Data }= "*5?" 5 {IF{REF Data }= "*6?" 6 {IF{REF Data }= "*7?" 7 {IF{REF Data }= "*8?" 8 {IF{REF Data }= "*9?" 9 0}}}}}}}}} {IF{REF Data }= "*1" 1 {IF{REF Data }= "*2" 2 {IF{REF Data }= "*3" 3 {IF{REF Data }= "*4" 4 {IF{REF Data }= "*5" 5 {IF{REF Data }= "*6" 6 {IF{REF Data }= "*7" 7 {IF{REF Data }= "*8" 8 {IF{REF Data }= "*9" 9 0}}}}}}}}}} |
#3
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
That worked brilliantly. Thanks so much.
"Doug Robbins - Word MVP" wrote: Use { IF { MERGEFIELD myfield } "" "{QUOTE{SET Data {MERGEFIELD myfield}}{=MOD({=INT({REF Data}/100)-1},100)+1 \ #00}} {IF{REF Data }= "*1?" 1 {IF{REF Data }= "*2?" 2 {IF{REF Data }= "*3?" 3 {IF{REF Data }= "*4?" 4 {IF{REF Data }= "*5?" 5 {IF{REF Data }= "*6?" 6 {IF{REF Data }= "*7?" 7 {IF{REF Data }= "*8?" 8 {IF{REF Data }= "*9?" 9 0}}}}}}}}} {IF{REF Data }= "*1" 1 {IF{REF Data }= "*2" 2 {IF{REF Data }= "*3" 3 {IF{REF Data }= "*4" 4 {IF{REF Data }= "*5" 5 {IF{REF Data }= "*6" 6 {IF{REF Data }= "*7" 7 {IF{REF Data }= "*8" 8 {IF{REF Data }= "*9" 9 0}}}}}}}}}} "" } I have assumed that you have correctly quoted the construction that Macropod gave you, though I have replaced "(" before the QUOTE with the required "{". All of the field delimiters { } must be entered by using Ctrl+F9. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Pixie" wrote in message ... Hello! macropod wrote me a great statement for displaying the last 4 digits of a 16-digit account number - see below: It works great but only if there is an account number in the field. It turns out that sometimes there isn't an account number in the field and I get a syntax error. I want to use an If Then Else statement to use the code if there is an account number but leave the field blank if there isn't an account number. I'm not sure how to do it. The Help is written to display "text" or not and I'm not sure how to deal with quotes and brackets. Thanks as always for your help! ![]() (QUOTE{SET Data {MERGEFIELD myfield}}{=MOD({=INT({REF Data}/100)-1},100)+1 \ #00}} {IF{REF Data }= "*1?" 1 {IF{REF Data }= "*2?" 2 {IF{REF Data }= "*3?" 3 {IF{REF Data }= "*4?" 4 {IF{REF Data }= "*5?" 5 {IF{REF Data }= "*6?" 6 {IF{REF Data }= "*7?" 7 {IF{REF Data }= "*8?" 8 {IF{REF Data }= "*9?" 9 0}}}}}}}}} {IF{REF Data }= "*1" 1 {IF{REF Data }= "*2" 2 {IF{REF Data }= "*3" 3 {IF{REF Data }= "*4" 4 {IF{REF Data }= "*5" 5 {IF{REF Data }= "*6" 6 {IF{REF Data }= "*7" 7 {IF{REF Data }= "*8" 8 {IF{REF Data }= "*9" 9 0}}}}}}}}}} |