Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
I have a program that interfaces with WORD for mailmerges but unfortunately
the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
Hi Fred,
You can overcome this with a compound field coded along the lines of: {QUOTE{SET Val1 {MERGEFIELD Data1}}{SET Val2 {MERGEFIELD Data2}}{=Val1+Val2 \# 0}} Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message. -- Cheers macropod [MVP - Microsoft Word] "Fred" wrote in message ... I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
On a more simple level you could just use a conditional field eg
{={Mergefield a} + {IF {Mergefield b} = "" "0" "{Mergefield b}"}} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Fred wrote: I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
Hi Graham,
What if Mergefield 'a' can return nul also? The field code I posted deals with both scenarios. To deal with just 'b', one could also use: {QUOTE{SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0}} or even: {SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0} which is simpler still! -- Cheers macropod [MVP - Microsoft Word] "Graham Mayor" wrote in message ... On a more simple level you could just use a conditional field eg {={Mergefield a} + {IF {Mergefield b} = "" "0" "{Mergefield b}"}} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Fred wrote: I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#5
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
On a simple level I meant a level that the OP may understand It was said
that only b might be empty, but it would be easy enough to process a in the same way. I do like your second version -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, What if Mergefield 'a' can return nul also? The field code I posted deals with both scenarios. To deal with just 'b', one could also use: {QUOTE{SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0}} or even: {SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0} which is simpler still! "Graham Mayor" wrote in message ... On a more simple level you could just use a conditional field eg {={Mergefield a} + {IF {Mergefield b} = "" "0" "{Mergefield b}"}} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Fred wrote: I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#6
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
Hi Graham,
This approach is certainly more compact than using IF tests. My first post in this thread shows how one could process many nuls without resorting to a miriad of IF tests, and keeping the ultimate formula intelligible. -- Cheers macropod [MVP - Microsoft Word] "Graham Mayor" wrote in message ... On a simple level I meant a level that the OP may understand It was said that only b might be empty, but it would be easy enough to process a in the same way. I do like your second version -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, What if Mergefield 'a' can return nul also? The field code I posted deals with both scenarios. To deal with just 'b', one could also use: {QUOTE{SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0}} or even: {SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0} which is simpler still! "Graham Mayor" wrote in message ... On a more simple level you could just use a conditional field eg {={Mergefield a} + {IF {Mergefield b} = "" "0" "{Mergefield b}"}} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Fred wrote: I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#7
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
Indeed! I wasn't doubting you
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, This approach is certainly more compact than using IF tests. My first post in this thread shows how one could process many nuls without resorting to a miriad of IF tests, and keeping the ultimate formula intelligible. "Graham Mayor" wrote in message ... On a simple level I meant a level that the OP may understand It was said that only b might be empty, but it would be easy enough to process a in the same way. I do like your second version -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, What if Mergefield 'a' can return nul also? The field code I posted deals with both scenarios. To deal with just 'b', one could also use: {QUOTE{SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0}} or even: {SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0} which is simpler still! "Graham Mayor" wrote in message ... On a more simple level you could just use a conditional field eg {={Mergefield a} + {IF {Mergefield b} = "" "0" "{Mergefield b}"}} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Fred wrote: I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#8
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
I am not sure why, but neither post worked. I even used the CTRL + F9 to
create the brackets. I used all the same spaces and verbiage you guys had used. The wierd thing is, after I saved the document and closed it and went back into it and did a toggle fields, most of the information was gone except for the beginning part. Any ideas? Anything you want me to supply to you to better help solve my problem? Thanks, Fred "Graham Mayor" wrote: Indeed! I wasn't doubting you -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, This approach is certainly more compact than using IF tests. My first post in this thread shows how one could process many nuls without resorting to a miriad of IF tests, and keeping the ultimate formula intelligible. "Graham Mayor" wrote in message ... On a simple level I meant a level that the OP may understand It was said that only b might be empty, but it would be easy enough to process a in the same way. I do like your second version -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, What if Mergefield 'a' can return nul also? The field code I posted deals with both scenarios. To deal with just 'b', one could also use: {QUOTE{SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0}} or even: {SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0} which is simpler still! "Graham Mayor" wrote in message ... On a more simple level you could just use a conditional field eg {={Mergefield a} + {IF {Mergefield b} = "" "0" "{Mergefield b}"}} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Fred wrote: I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#9
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
This is what got returned:
!Syntax Error, + {=+0} "Graham Mayor" wrote: Indeed! I wasn't doubting you -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, This approach is certainly more compact than using IF tests. My first post in this thread shows how one could process many nuls without resorting to a miriad of IF tests, and keeping the ultimate formula intelligible. "Graham Mayor" wrote in message ... On a simple level I meant a level that the OP may understand It was said that only b might be empty, but it would be easy enough to process a in the same way. I do like your second version -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, What if Mergefield 'a' can return nul also? The field code I posted deals with both scenarios. To deal with just 'b', one could also use: {QUOTE{SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0}} or even: {SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0} which is simpler still! "Graham Mayor" wrote in message ... On a more simple level you could just use a conditional field eg {={Mergefield a} + {IF {Mergefield b} = "" "0" "{Mergefield b}"}} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Fred wrote: I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#10
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
The construction in Macropod's initial response works fine here not matter
what the Mergefields return (Null, a number, a character) Therefore, I believe that you must have made an error in creating the field construction. If you select the {=+0} and press Alt+F9 is it replaced by something else? -- 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 "Fred" wrote in message ... This is what got returned: !Syntax Error, + {=+0} "Graham Mayor" wrote: Indeed! I wasn't doubting you -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, This approach is certainly more compact than using IF tests. My first post in this thread shows how one could process many nuls without resorting to a miriad of IF tests, and keeping the ultimate formula intelligible. "Graham Mayor" wrote in message ... On a simple level I meant a level that the OP may understand It was said that only b might be empty, but it would be easy enough to process a in the same way. I do like your second version -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, What if Mergefield 'a' can return nul also? The field code I posted deals with both scenarios. To deal with just 'b', one could also use: {QUOTE{SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0}} or even: {SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0} which is simpler still! "Graham Mayor" wrote in message ... On a more simple level you could just use a conditional field eg {={Mergefield a} + {IF {Mergefield b} = "" "0" "{Mergefield b}"}} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Fred wrote: I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#11
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
Hi Fred,
If you use the coding version without the enclosing QUOTE field, you'll get syntax errors until the merge is run. That's because the second field needs the bookmark from the first field, which won't have been set yet. Wrapping both fields in a QUOTE field ensures they'r updated together. -- Cheers macropod [MVP - Microsoft Word] "Fred" wrote in message ... This is what got returned: !Syntax Error, + {=+0} "Graham Mayor" wrote: Indeed! I wasn't doubting you -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, This approach is certainly more compact than using IF tests. My first post in this thread shows how one could process many nuls without resorting to a miriad of IF tests, and keeping the ultimate formula intelligible. "Graham Mayor" wrote in message ... On a simple level I meant a level that the OP may understand It was said that only b might be empty, but it would be easy enough to process a in the same way. I do like your second version -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, What if Mergefield 'a' can return nul also? The field code I posted deals with both scenarios. To deal with just 'b', one could also use: {QUOTE{SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0}} or even: {SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0} which is simpler still! "Graham Mayor" wrote in message ... On a more simple level you could just use a conditional field eg {={Mergefield a} + {IF {Mergefield b} = "" "0" "{Mergefield b}"}} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Fred wrote: I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#12
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
Macropod,
I have used your syntax line exactly as you had earlier and when the data is merged, I get the following: 0 Now, if someone is able to get this to work for me, I will gladly pay them, if it is not too expensive of course. I am not a programmer but I do well in following directions. Thanks, Fred "macropod" wrote: Hi Fred, If you use the coding version without the enclosing QUOTE field, you'll get syntax errors until the merge is run. That's because the second field needs the bookmark from the first field, which won't have been set yet. Wrapping both fields in a QUOTE field ensures they'r updated together. -- Cheers macropod [MVP - Microsoft Word] "Fred" wrote in message ... This is what got returned: !Syntax Error, + {=+0} "Graham Mayor" wrote: Indeed! I wasn't doubting you -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, This approach is certainly more compact than using IF tests. My first post in this thread shows how one could process many nuls without resorting to a miriad of IF tests, and keeping the ultimate formula intelligible. "Graham Mayor" wrote in message ... On a simple level I meant a level that the OP may understand It was said that only b might be empty, but it would be easy enough to process a in the same way. I do like your second version -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, What if Mergefield 'a' can return nul also? The field code I posted deals with both scenarios. To deal with just 'b', one could also use: {QUOTE{SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0}} or even: {SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0} which is simpler still! "Graham Mayor" wrote in message ... On a more simple level you could just use a conditional field eg {={Mergefield a} + {IF {Mergefield b} = "" "0" "{Mergefield b}"}} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Fred wrote: I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
#13
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Mailmerge Help
Macropod,
Never mind. I am sorry. It was my fault. I guess I need some good glasses because I was off a little bit on the {{. You did an awesome job and I thank you very much!!!!! Thanks, Fred "macropod" wrote: Hi Fred, If you use the coding version without the enclosing QUOTE field, you'll get syntax errors until the merge is run. That's because the second field needs the bookmark from the first field, which won't have been set yet. Wrapping both fields in a QUOTE field ensures they'r updated together. -- Cheers macropod [MVP - Microsoft Word] "Fred" wrote in message ... This is what got returned: !Syntax Error, + {=+0} "Graham Mayor" wrote: Indeed! I wasn't doubting you -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, This approach is certainly more compact than using IF tests. My first post in this thread shows how one could process many nuls without resorting to a miriad of IF tests, and keeping the ultimate formula intelligible. "Graham Mayor" wrote in message ... On a simple level I meant a level that the OP may understand It was said that only b might be empty, but it would be easy enough to process a in the same way. I do like your second version -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macropod wrote: Hi Graham, What if Mergefield 'a' can return nul also? The field code I posted deals with both scenarios. To deal with just 'b', one could also use: {QUOTE{SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0}} or even: {SET b {MERGEFIELD b}}{={MERGEFIELD a}+b \# 0} which is simpler still! "Graham Mayor" wrote in message ... On a more simple level you could just use a conditional field eg {={Mergefield a} + {IF {Mergefield b} = "" "0" "{Mergefield b}"}} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Fred wrote: I have a program that interfaces with WORD for mailmerges but unfortunately the program passes a blank as a null instead of a "0" when it comes to numbers. Here is my example I am hoping someone can help me. I am trying to add two fields "a" and "b" together but sometimes the "b" value might be blank and word errors out when it trys to add a value and a blank. I need help to properly add "a" and "b" when "b" is a null or if it has a number. I hope someone seems to understand my delima and can help out. Thansk, Fred |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
MailMerge | Microsoft Word Help | |||
Mailmerge | Microsoft Word Help | |||
Mailmerge | Mailmerge | |||
SQl mailmerge. | Microsoft Word Help | |||
SQl mailmerge. | Mailmerge |