Reply
 
Thread Tools Display Modes
  #1   Report Post  
julie
 
Posts: n/a
Default Suppressing Merge Field and text before/after

Using Word 2003, I'd like to suppress a merge field if certain conditions
exist, along with the preceeding and following text. I've been using the
MergeField options (obtained when I right click on a merge field and choose
Edit Field): Text to be included before & Text to be included after to
combine my merge field with text.

If I look at the Field Codes after setting up my text, I see...

MERGEFIELD Rubella_Due_DAte \b "We show that your auto insurance expires on
" \f ". Please submit proof of insurance including your name and new
expiration date."

Is there a way I can add an If, then, else to this so that If MERGEFIELD
Rubella_Due-DAte = 00/00/00 the merge field and it's preceding and following
text is suppressed? Can I simply edit the Field Codes text to include this?

I apologize if this is a dumb question. I'm new to conditional formatting
in Word. I'd also appreciate any pointers to good documents or books on this
topic.

Thanks,
--
Julie
  #2   Report Post  
macropod
 
Posts: n/a
Default Suppressing Merge Field and text before/after

Hi Julie,

Try:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" ""We show that your auto
insurance expires on {MERGEFIELD Rubella_Due-Date \@ dd/MM/yyyy}. Please
submit proof of insurance including your name and new expiration date."}

Cheers


"julie" wrote in message
...
Using Word 2003, I'd like to suppress a merge field if certain conditions
exist, along with the preceeding and following text. I've been using the
MergeField options (obtained when I right click on a merge field and

choose
Edit Field): Text to be included before & Text to be included after to
combine my merge field with text.

If I look at the Field Codes after setting up my text, I see...

MERGEFIELD Rubella_Due_DAte \b "We show that your auto insurance expires

on
" \f ". Please submit proof of insurance including your name and new
expiration date."

Is there a way I can add an If, then, else to this so that If MERGEFIELD
Rubella_Due-DAte = 00/00/00 the merge field and it's preceding and

following
text is suppressed? Can I simply edit the Field Codes text to include

this?

I apologize if this is a dumb question. I'm new to conditional formatting
in Word. I'd also appreciate any pointers to good documents or books on

this
topic.

Thanks,
--
Julie



  #3   Report Post  
Graham Mayor
 
Posts: n/a
Default Suppressing Merge Field and text before/after

An extra quote mark sneaked in to Macropod's reply - try

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" "We show that your auto
insurance expires on {MERGEFIELD Rubella_Due-Date \@ dd/MM/yyyy}. Please
submit proof of insurance including your name and new expiration date."}

With some versions of Word setting a nul result as the first option can
cause the wrong data to be entered. I therefore prefer to avoid this by
reversing the conditions thus:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd} 0 "We show that your auto
insurance expires on {MERGEFIELD Rubella_Due-Date \@ dd/MM/yyyy}. Please
submit proof of insurance including your name and new expiration date."}

The result should be the same.

There is some information on field formatting on my web site at
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


macropod wrote:
Hi Julie,

Try:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" ""We show that
your auto insurance expires on {MERGEFIELD Rubella_Due-Date \@
dd/MM/yyyy}. Please submit proof of insurance including your name
and new expiration date."}

Cheers


"julie" wrote in message
...
Using Word 2003, I'd like to suppress a merge field if certain
conditions exist, along with the preceeding and following text.
I've been using the MergeField options (obtained when I right click
on a merge field and choose Edit Field): Text to be included before
& Text to be included after to combine my merge field with text.

If I look at the Field Codes after setting up my text, I see...

MERGEFIELD Rubella_Due_DAte \b "We show that your auto insurance
expires on " \f ". Please submit proof of insurance including your
name and new expiration date."

Is there a way I can add an If, then, else to this so that If
MERGEFIELD Rubella_Due-DAte = 00/00/00 the merge field and it's
preceding and following text is suppressed? Can I simply edit the
Field Codes text to include this?

I apologize if this is a dumb question. I'm new to conditional
formatting in Word. I'd also appreciate any pointers to good
documents or books on this topic.

Thanks,
--
Julie



  #4   Report Post  
julie
 
Posts: n/a
Default Suppressing Merge Field and text before/after

Thank you both for your quick help. I've tried to paste the example into the
Advanced Field Properties Field Codes field and even when I can get the
whole string in, I don't get an active OK button. Is there a trick to this
or another place I should go to edit the statement?
Thanks again,
--
Julie

"Graham Mayor" wrote:

An extra quote mark sneaked in to Macropod's reply - try

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" "We show that your auto
insurance expires on {MERGEFIELD Rubella_Due-Date \@ dd/MM/yyyy}. Please
submit proof of insurance including your name and new expiration date."}

With some versions of Word setting a nul result as the first option can
cause the wrong data to be entered. I therefore prefer to avoid this by
reversing the conditions thus:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd} 0 "We show that your auto
insurance expires on {MERGEFIELD Rubella_Due-Date \@ dd/MM/yyyy}. Please
submit proof of insurance including your name and new expiration date."}

The result should be the same.

There is some information on field formatting on my web site at
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


macropod wrote:
Hi Julie,

Try:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" ""We show that
your auto insurance expires on {MERGEFIELD Rubella_Due-Date \@
dd/MM/yyyy}. Please submit proof of insurance including your name
and new expiration date."}

Cheers


"julie" wrote in message
...
Using Word 2003, I'd like to suppress a merge field if certain
conditions exist, along with the preceeding and following text.
I've been using the MergeField options (obtained when I right click
on a merge field and choose Edit Field): Text to be included before
& Text to be included after to combine my merge field with text.

If I look at the Field Codes after setting up my text, I see...

MERGEFIELD Rubella_Due_DAte \b "We show that your auto insurance
expires on " \f ". Please submit proof of insurance including your
name and new expiration date."

Is there a way I can add an If, then, else to this so that If
MERGEFIELD Rubella_Due-DAte = 00/00/00 the merge field and it's
preceding and following text is suppressed? Can I simply edit the
Field Codes text to include this?

I apologize if this is a dumb question. I'm new to conditional
formatting in Word. I'd also appreciate any pointers to good
documents or books on this topic.

Thanks,
--
Julie




  #5   Report Post  
Suzanne S. Barnhill
 
Posts: n/a
Default Suppressing Merge Field and text before/after

You need to create this field by hand. Press Ctrl+F9 to insert field
delimiters (the things that look like braces but can't be entered from the
keyboard) and type the text between them (you'll need to insert the merge
fields from the Mail Merge toolbar or by entering another hand-constructed
field).

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"julie" wrote in message
...
Thank you both for your quick help. I've tried to paste the example into

the
Advanced Field Properties Field Codes field and even when I can get the
whole string in, I don't get an active OK button. Is there a trick to

this
or another place I should go to edit the statement?
Thanks again,
--
Julie

"Graham Mayor" wrote:

An extra quote mark sneaked in to Macropod's reply - try

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" "We show that your

auto
insurance expires on {MERGEFIELD Rubella_Due-Date \@ dd/MM/yyyy}.

Please
submit proof of insurance including your name and new expiration date."}

With some versions of Word setting a nul result as the first option can
cause the wrong data to be entered. I therefore prefer to avoid this by
reversing the conditions thus:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd} 0 "We show that your

auto
insurance expires on {MERGEFIELD Rubella_Due-Date \@ dd/MM/yyyy}.

Please
submit proof of insurance including your name and new expiration date."}

The result should be the same.

There is some information on field formatting on my web site at
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


macropod wrote:
Hi Julie,

Try:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" ""We show that
your auto insurance expires on {MERGEFIELD Rubella_Due-Date \@
dd/MM/yyyy}. Please submit proof of insurance including your name
and new expiration date."}

Cheers


"julie" wrote in message
...
Using Word 2003, I'd like to suppress a merge field if certain
conditions exist, along with the preceeding and following text.
I've been using the MergeField options (obtained when I right click
on a merge field and choose Edit Field): Text to be included before
& Text to be included after to combine my merge field with text.

If I look at the Field Codes after setting up my text, I see...

MERGEFIELD Rubella_Due_DAte \b "We show that your auto insurance
expires on " \f ". Please submit proof of insurance including your
name and new expiration date."

Is there a way I can add an If, then, else to this so that If
MERGEFIELD Rubella_Due-DAte = 00/00/00 the merge field and it's
preceding and following text is suppressed? Can I simply edit the
Field Codes text to include this?

I apologize if this is a dumb question. I'm new to conditional
formatting in Word. I'd also appreciate any pointers to good
documents or books on this topic.

Thanks,
--
Julie







  #6   Report Post  
julie
 
Posts: n/a
Default Suppressing Merge Field and text before/after

Thank you all. I have this working beautifully.

Now, I have another challenge (if anyone is willing to help). I'd like to
compare the merge field date to today's date + 2 months (e.g., if today is
11/11/2005 and the merge date is 1/1/2006 or greater, I'd like to supress the
merge field and text). Here's what I've been working with to see if I can
insert Field Date in the field code to start with, but this produces
nothing (not even an error). I'd appreciate any ideas you have. Once I get
this working, then I'd need to figure out how to add two months to the system
date. The following is what I see when I press SHIFT + F9...

{IF «Lic_1_Exp_date» = {DATE \* MERGEFORMAT} "" "We show that your
driver's license expires on {MERGEFIELD "Lic_1_Exp_date"}. Please submit an
updated copy of your driver's license."}




Thank you again.
--
Julie



"Suzanne S. Barnhill" wrote:

You need to create this field by hand. Press Ctrl+F9 to insert field
delimiters (the things that look like braces but can't be entered from the
keyboard) and type the text between them (you'll need to insert the merge
fields from the Mail Merge toolbar or by entering another hand-constructed
field).

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"julie" wrote in message
...
Thank you both for your quick help. I've tried to paste the example into

the
Advanced Field Properties Field Codes field and even when I can get the
whole string in, I don't get an active OK button. Is there a trick to

this
or another place I should go to edit the statement?
Thanks again,
--
Julie

"Graham Mayor" wrote:

An extra quote mark sneaked in to Macropod's reply - try

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" "We show that your

auto
insurance expires on {MERGEFIELD Rubella_Due-Date \@ dd/MM/yyyy}.

Please
submit proof of insurance including your name and new expiration date."}

With some versions of Word setting a nul result as the first option can
cause the wrong data to be entered. I therefore prefer to avoid this by
reversing the conditions thus:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd} 0 "We show that your

auto
insurance expires on {MERGEFIELD Rubella_Due-Date \@ dd/MM/yyyy}.

Please
submit proof of insurance including your name and new expiration date."}

The result should be the same.

There is some information on field formatting on my web site at
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


macropod wrote:
Hi Julie,

Try:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" ""We show that
your auto insurance expires on {MERGEFIELD Rubella_Due-Date \@
dd/MM/yyyy}. Please submit proof of insurance including your name
and new expiration date."}

Cheers


"julie" wrote in message
...
Using Word 2003, I'd like to suppress a merge field if certain
conditions exist, along with the preceeding and following text.
I've been using the MergeField options (obtained when I right click
on a merge field and choose Edit Field): Text to be included before
& Text to be included after to combine my merge field with text.

If I look at the Field Codes after setting up my text, I see...

MERGEFIELD Rubella_Due_DAte \b "We show that your auto insurance
expires on " \f ". Please submit proof of insurance including your
name and new expiration date."

Is there a way I can add an If, then, else to this so that If
MERGEFIELD Rubella_Due-DAte = 00/00/00 the merge field and it's
preceding and following text is suppressed? Can I simply edit the
Field Codes text to include this?

I apologize if this is a dumb question. I'm new to conditional
formatting in Word. I'd also appreciate any pointers to good
documents or books on this topic.

Thanks,
--
Julie





  #7   Report Post  
Graham Mayor
 
Posts: n/a
Default Suppressing Merge Field and text before/after

This type of comparison is covered at
http://www.gmayor.com/formatting_word_fields.htm however the calculation
required to add the 2 months to the current date is extremely complex and
can be seen at http://www.gmayor.com/insert_a_date_...than_today.htm To
incorporate the two into a single calculation will be fun Thus:

{ IF { Mergefield Lic_1_Exp_date \@ "yyyyMMdd" } = "{QUOTE{SET Delay
2}{SET mm{=MOD({DATE \@ M}+Delay-1,12)+1}}{SET yy{={DATE \@
yyyy}+INT((Delay+{DATE \@ M}-1)/12)}}{SET dd{=IF(({DATE \@
d}28)*(mm=2)*((MOD(yy,4)=0)+(MOD(yy,400)=0)-(MOD(yy,100)=0))=1,29,IF(({DATE
\@ d}29)*(mm=2)=1,28,IF((mm=4)+(mm=6)+(mm=9)+(mm=11) +({DATE \@
d}30)1,30,{DATE \@ d})))}}{=dd*10^6+mm*10^4+yy \# "00'-'00'-'0000"} \@
"yyyyMMdd"}" "We show that your driver's license expires on { MERGEFIELD
Lic_1_Exp_date \@ "d MMM yyyy" }. Please submit an updated copy of your
driver's license." }

It may be simpler to add the future date to your database and compare with
that.

Credit goes to ng contributor 'Macropod' for the work on calculations - see
the extent of this in his document linked from
http://www.gmayor.com/insert_a_date_...than_today.htm

If you contact me via the feedback link on my web site, I will mail you a
document containing the calculation, which you can paste into your merge
document, for I fear you will never duplicate the above manually.
--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org

julie wrote:
Thank you all. I have this working beautifully.

Now, I have another challenge (if anyone is willing to help). I'd
like to compare the merge field date to today's date + 2 months
(e.g., if today is 11/11/2005 and the merge date is 1/1/2006 or
greater, I'd like to supress the merge field and text). Here's what
I've been working with to see if I can insert Field Date in the
field code to start with, but this produces nothing (not even an
error). I'd appreciate any ideas you have. Once I get this working,
then I'd need to figure out how to add two months to the system date.
The following is what I see when I press SHIFT + F9...

{IF «Lic_1_Exp_date» = {DATE \* MERGEFORMAT} "" "We show that your
driver's license expires on {MERGEFIELD "Lic_1_Exp_date"}. Please
submit an updated copy of your driver's license."}




Thank you again.

You need to create this field by hand. Press Ctrl+F9 to insert field
delimiters (the things that look like braces but can't be entered
from the keyboard) and type the text between them (you'll need to
insert the merge fields from the Mail Merge toolbar or by entering
another hand-constructed field).

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

"julie" wrote in message
...
Thank you both for your quick help. I've tried to paste the
example into the Advanced Field Properties Field Codes field and
even when I can get the whole string in, I don't get an active OK
button. Is there a trick to this or another place I should go to
edit the statement?
Thanks again,
--
Julie

"Graham Mayor" wrote:

An extra quote mark sneaked in to Macropod's reply - try

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" "We show that
your auto insurance expires on {MERGEFIELD Rubella_Due-Date \@
dd/MM/yyyy}. Please submit proof of insurance including your name
and new expiration date."}

With some versions of Word setting a nul result as the first
option can cause the wrong data to be entered. I therefore prefer
to avoid this by reversing the conditions thus:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd} 0 "We show that
your auto insurance expires on {MERGEFIELD Rubella_Due-Date \@
dd/MM/yyyy}. Please submit proof of insurance including your name
and new expiration date."}

The result should be the same.

There is some information on field formatting on my web site at
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


macropod wrote:
Hi Julie,

Try:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" ""We show that
your auto insurance expires on {MERGEFIELD Rubella_Due-Date \@
dd/MM/yyyy}. Please submit proof of insurance including your name
and new expiration date."}

Cheers


"julie" wrote in message
...
Using Word 2003, I'd like to suppress a merge field if certain
conditions exist, along with the preceeding and following text.
I've been using the MergeField options (obtained when I right
click on a merge field and choose Edit Field): Text to be
included before & Text to be included after to combine my merge
field with text.

If I look at the Field Codes after setting up my text, I see...

MERGEFIELD Rubella_Due_DAte \b "We show that your auto insurance
expires on " \f ". Please submit proof of insurance including
your name and new expiration date."

Is there a way I can add an If, then, else to this so that If
MERGEFIELD Rubella_Due-DAte = 00/00/00 the merge field and it's
preceding and following text is suppressed? Can I simply edit
the Field Codes text to include this?

I apologize if this is a dumb question. I'm new to conditional
formatting in Word. I'd also appreciate any pointers to good
documents or books on this topic.

Thanks,
--
Julie



  #8   Report Post  
macropod
 
Posts: n/a
Default Suppressing Merge Field and text before/after

Hi Julie,

Calculating dates for use with mergefields is pretty complicated. The actual
coding you're after could be expressed as:
{QUOTE
{SET Delay 2}
{SET mm{=MOD({DATE \@ M}+Delay-1,12)+1}}
{SET yy{={DATE \@ yyyy}+INT((Delay+{DATE \@ M}-1)/12)}}
{SET dd{=IF(({DATE \@
d}28)*(mm=2)=1,28+((MOD(yy,4)=0)+(MOD(yy,400)=0)-(MOD(yy,100)=0)),IF((mm=4)
+(mm=6)+(mm=9)+(mm=11)+({DATE \@ d}30)1,30,{DATE \@ d}))}}
{IF{MAILMERGE Lic_1_Exp_Date \@ yyyyMMdd}{=yy*10^4+mm*10^2+dd} "" "We show
that your driver's license expires on {MAILMERGE Lic_1_Exp_Date}. Please
submit an updated copy of your driver's license."}}
where the 'Delay' value is the number of months offset to be calculated.

Much of the complication in the coding relates to months being of different
lengths, plus having to allow for year changes and leap years! If you only
needed to test the month & year, rather than the day, month and year, the
coding would be much simpler.

Most of the above code before the line starting "{IF{MAILMERGE
Lic_1_Exp_Date " comes from my 'Date Calculations' tutorial at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=249902
The particular entry I built the above from is found under the heading
"Calculate a day, date, month and year, using n (10) months delay". You may
want to use that as your starting point, rather than coding the lot from
scratch.

Cheers


"julie" wrote in message
...
Thank you all. I have this working beautifully.

Now, I have another challenge (if anyone is willing to help). I'd like to
compare the merge field date to today's date + 2 months (e.g., if today is
11/11/2005 and the merge date is 1/1/2006 or greater, I'd like to supress

the
merge field and text). Here's what I've been working with to see if I can
insert Field Date in the field code to start with, but this produces
nothing (not even an error). I'd appreciate any ideas you have. Once I

get
this working, then I'd need to figure out how to add two months to the

system
date. The following is what I see when I press SHIFT + F9...

{IF «Lic_1_Exp_date» = {DATE \* MERGEFORMAT} "" "We show that your
driver's license expires on {MERGEFIELD "Lic_1_Exp_date"}. Please submit

an
updated copy of your driver's license."}




Thank you again.
--
Julie



"Suzanne S. Barnhill" wrote:

You need to create this field by hand. Press Ctrl+F9 to insert field
delimiters (the things that look like braces but can't be entered from

the
keyboard) and type the text between them (you'll need to insert the

merge
fields from the Mail Merge toolbar or by entering another

hand-constructed
field).

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

"julie" wrote in message
...
Thank you both for your quick help. I've tried to paste the example

into
the
Advanced Field Properties Field Codes field and even when I can get

the
whole string in, I don't get an active OK button. Is there a trick to

this
or another place I should go to edit the statement?
Thanks again,
--
Julie

"Graham Mayor" wrote:

An extra quote mark sneaked in to Macropod's reply - try

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" "We show that

your
auto
insurance expires on {MERGEFIELD Rubella_Due-Date \@ dd/MM/yyyy}.

Please
submit proof of insurance including your name and new expiration

date."}

With some versions of Word setting a nul result as the first option

can
cause the wrong data to be entered. I therefore prefer to avoid this

by
reversing the conditions thus:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd} 0 "We show that your

auto
insurance expires on {MERGEFIELD Rubella_Due-Date \@ dd/MM/yyyy}.

Please
submit proof of insurance including your name and new expiration

date."}

The result should be the same.

There is some information on field formatting on my web site at
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


macropod wrote:
Hi Julie,

Try:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" ""We show that
your auto insurance expires on {MERGEFIELD Rubella_Due-Date \@
dd/MM/yyyy}. Please submit proof of insurance including your name
and new expiration date."}

Cheers


"julie" wrote in message
...
Using Word 2003, I'd like to suppress a merge field if certain
conditions exist, along with the preceeding and following text.
I've been using the MergeField options (obtained when I right

click
on a merge field and choose Edit Field): Text to be included

before
& Text to be included after to combine my merge field with text.

If I look at the Field Codes after setting up my text, I see...

MERGEFIELD Rubella_Due_DAte \b "We show that your auto insurance
expires on " \f ". Please submit proof of insurance including

your
name and new expiration date."

Is there a way I can add an If, then, else to this so that If
MERGEFIELD Rubella_Due-DAte = 00/00/00 the merge field and it's
preceding and following text is suppressed? Can I simply edit

the
Field Codes text to include this?

I apologize if this is a dumb question. I'm new to conditional
formatting in Word. I'd also appreciate any pointers to good
documents or books on this topic.

Thanks,
--
Julie







  #9   Report Post  
julie
 
Posts: n/a
Default Suppressing Merge Field and text before/after

Thank you both. The source for this merge is a database report and I see it
would be easier to create a calculated field there, but thank you for
satisfying my curiosity. I've also been finding the material at the
word.mvps.org site helpful and interesting.
Regards,
--
Julie

"Graham Mayor" wrote:

This type of comparison is covered at
http://www.gmayor.com/formatting_word_fields.htm however the calculation
required to add the 2 months to the current date is extremely complex and
can be seen at http://www.gmayor.com/insert_a_date_...than_today.htm To
incorporate the two into a single calculation will be fun Thus:

{ IF { Mergefield Lic_1_Exp_date \@ "yyyyMMdd" } = "{QUOTE{SET Delay
2}{SET mm{=MOD({DATE \@ M}+Delay-1,12)+1}}{SET yy{={DATE \@
yyyy}+INT((Delay+{DATE \@ M}-1)/12)}}{SET dd{=IF(({DATE \@
d}28)*(mm=2)*((MOD(yy,4)=0)+(MOD(yy,400)=0)-(MOD(yy,100)=0))=1,29,IF(({DATE
\@ d}29)*(mm=2)=1,28,IF((mm=4)+(mm=6)+(mm=9)+(mm=11) +({DATE \@
d}30)1,30,{DATE \@ d})))}}{=dd*10^6+mm*10^4+yy \# "00'-'00'-'0000"} \@
"yyyyMMdd"}" "We show that your driver's license expires on { MERGEFIELD
Lic_1_Exp_date \@ "d MMM yyyy" }. Please submit an updated copy of your
driver's license." }

It may be simpler to add the future date to your database and compare with
that.

Credit goes to ng contributor 'Macropod' for the work on calculations - see
the extent of this in his document linked from
http://www.gmayor.com/insert_a_date_...than_today.htm

If you contact me via the feedback link on my web site, I will mail you a
document containing the calculation, which you can paste into your merge
document, for I fear you will never duplicate the above manually.
--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org

julie wrote:
Thank you all. I have this working beautifully.

Now, I have another challenge (if anyone is willing to help). I'd
like to compare the merge field date to today's date + 2 months
(e.g., if today is 11/11/2005 and the merge date is 1/1/2006 or
greater, I'd like to supress the merge field and text). Here's what
I've been working with to see if I can insert Field Date in the
field code to start with, but this produces nothing (not even an
error). I'd appreciate any ideas you have. Once I get this working,
then I'd need to figure out how to add two months to the system date.
The following is what I see when I press SHIFT + F9...

{IF «Lic_1_Exp_date» = {DATE \* MERGEFORMAT} "" "We show that your
driver's license expires on {MERGEFIELD "Lic_1_Exp_date"}. Please
submit an updated copy of your driver's license."}




Thank you again.

You need to create this field by hand. Press Ctrl+F9 to insert field
delimiters (the things that look like braces but can't be entered
from the keyboard) and type the text between them (you'll need to
insert the merge fields from the Mail Merge toolbar or by entering
another hand-constructed field).

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

"julie" wrote in message
...
Thank you both for your quick help. I've tried to paste the
example into the Advanced Field Properties Field Codes field and
even when I can get the whole string in, I don't get an active OK
button. Is there a trick to this or another place I should go to
edit the statement?
Thanks again,
--
Julie

"Graham Mayor" wrote:

An extra quote mark sneaked in to Macropod's reply - try

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" "We show that
your auto insurance expires on {MERGEFIELD Rubella_Due-Date \@
dd/MM/yyyy}. Please submit proof of insurance including your name
and new expiration date."}

With some versions of Word setting a nul result as the first
option can cause the wrong data to be entered. I therefore prefer
to avoid this by reversing the conditions thus:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd} 0 "We show that
your auto insurance expires on {MERGEFIELD Rubella_Due-Date \@
dd/MM/yyyy}. Please submit proof of insurance including your name
and new expiration date."}

The result should be the same.

There is some information on field formatting on my web site at
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


macropod wrote:
Hi Julie,

Try:

{IF{MERGEFIELD Rubella_Due-Date \@ yyyyMMdd}= 0 "" ""We show that
your auto insurance expires on {MERGEFIELD Rubella_Due-Date \@
dd/MM/yyyy}. Please submit proof of insurance including your name
and new expiration date."}

Cheers


"julie" wrote in message
...
Using Word 2003, I'd like to suppress a merge field if certain
conditions exist, along with the preceeding and following text.
I've been using the MergeField options (obtained when I right
click on a merge field and choose Edit Field): Text to be
included before & Text to be included after to combine my merge
field with text.

If I look at the Field Codes after setting up my text, I see...

MERGEFIELD Rubella_Due_DAte \b "We show that your auto insurance
expires on " \f ". Please submit proof of insurance including
your name and new expiration date."

Is there a way I can add an If, then, else to this so that If
MERGEFIELD Rubella_Due-DAte = 00/00/00 the merge field and it's
preceding and following text is suppressed? Can I simply edit
the Field Codes text to include this?

I apologize if this is a dumb question. I'm new to conditional
formatting in Word. I'd also appreciate any pointers to good
documents or books on this topic.

Thanks,
--
Julie




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
Creating dynamic cross reference links in a Word document torajudo Microsoft Word Help 5 April 27th 23 08:57 PM
Next Record merge field with text boxes Hand Prints Mailmerge 2 October 27th 05 07:32 AM
HTML text in Merge Field TM360 Mailmerge 3 August 20th 05 10:41 AM
Word not to insert a merge field if the text or value is 0 markwimbush Mailmerge 1 May 16th 05 07:47 PM
Text Form Field Ref in Footer Won't Update on Screen StarWine Microsoft Word Help 3 December 6th 04 06:17 PM


All times are GMT +1. The time now is 09:15 PM.

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"