#1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Fred Fred is offline
external usenet poster
 
Posts: 55
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Fred Fred is offline
external usenet poster
 
Posts: 55
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Fred Fred is offline
external usenet poster
 
Posts: 55
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Fred Fred is offline
external usenet poster
 
Posts: 55
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Fred Fred is offline
external usenet poster
 
Posts: 55
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MailMerge ebITmgr Microsoft Word Help 1 May 8th 08 03:28 PM
Mailmerge EarlCPhillips Microsoft Word Help 1 May 2nd 08 09:13 PM
Mailmerge ll Mailmerge 1 January 24th 08 07:25 AM
SQl mailmerge. Jørgen Bondesen Microsoft Word Help 0 November 12th 05 11:23 AM
SQl mailmerge. Jørgen Bondesen Mailmerge 0 November 12th 05 11:23 AM


All times are GMT +1. The time now is 08:08 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"