Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
manatee08 manatee08 is offline
external usenet poster
 
Posts: 3
Default IF THEN ELSE CODE

Can someone please tell me what is wrong with this code. What I am trying to
do is:

IF NationalFilingDate field is blank, THEN input the ApplicationDate ELSE
input the NationalFilingDate using the format of MMMM dd, yyyy. This is the
code that I have so far:

{ IF { MERGEFIELD NationalFilingDate }= { MERGEFIELD ApplicationDate \@
MMMM dd, yyyy } { MERGFIELD NationalFilingDate \@ MMMM dd, yyyy} }
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default IF THEN ELSE CODE

Are you sure that a blank record entry actually does produce a blank? Insert
the field on its own and see what it produces, then trap that. Otherwise
apart from the smart quotes it looks OK.

Personally I would quote the alternative options also

{ IF { MERGEFIELD NationalFilingDate }= "" "{ MERGEFIELD ApplicationDate \@
"MMMM dd, yyyy" }" "{ MERGFIELD NationalFilingDate \@ "MMMM dd, yyyy"}" }

--

Graham Mayor - Word MVP

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



"manatee08" wrote in message
...
Can someone please tell me what is wrong with this code. What I am trying
to
do is:

IF NationalFilingDate field is blank, THEN input the ApplicationDate ELSE
input the NationalFilingDate using the format of MMMM dd, yyyy. This is
the
code that I have so far:

{ IF { MERGEFIELD NationalFilingDate }= "" { MERGEFIELD ApplicationDate \@
"MMMM dd, yyyy" } { MERGFIELD NationalFilingDate \@ "MMMM dd, yyyy"} }



  #3   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 IF THEN ELSE CODE

What result are you getting?

Did you use Ctrl+F9 to insert each pair of field delimiters { }?

Have you toggle off the display of the field codes and executed the merge?

--
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, originally posted via msnews.microsoft.com

"manatee08" wrote in message
...
Can someone please tell me what is wrong with this code. What I am trying
to
do is:

IF NationalFilingDate field is blank, THEN input the ApplicationDate ELSE
input the NationalFilingDate using the format of MMMM dd, yyyy. This is
the
code that I have so far:

{ IF { MERGEFIELD NationalFilingDate }= { MERGEFIELD ApplicationDate \@
MMMM dd, yyyy } { MERGFIELD NationalFilingDate \@ MMMM dd, yyyy} }


  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
manatee08 manatee08 is offline
external usenet poster
 
Posts: 3
Default IF THEN ELSE CODE

When the field NationalFilingDate is blank, it produces this result: 12:00:00
AM.
Because of this, I am assuming that ApplicationDate won't be produced
because the field is not actually blank, right?

Using the code above, when the NationalFilingDate has no date in the field,
the ApplicationDate has today's date rather than the ApplicationDate, which
by itself produces 10/15/2008.



"Graham Mayor" wrote:

Are you sure that a blank record entry actually does produce a blank? Insert
the field on its own and see what it produces, then trap that. Otherwise
apart from the smart quotes it looks OK.

Personally I would quote the alternative options also

{ IF { MERGEFIELD NationalFilingDate }= "" "{ MERGEFIELD ApplicationDate \@
"MMMM dd, yyyy" }" "{ MERGFIELD NationalFilingDate \@ "MMMM dd, yyyy"}" }

--

Graham Mayor - Word MVP

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



"manatee08" wrote in message
...
Can someone please tell me what is wrong with this code. What I am trying
to
do is:

IF NationalFilingDate field is blank, THEN input the ApplicationDate ELSE
input the NationalFilingDate using the format of MMMM dd, yyyy. This is
the
code that I have so far:

{ IF { MERGEFIELD NationalFilingDate }= "" { MERGEFIELD ApplicationDate \@
"MMMM dd, yyyy" } { MERGFIELD NationalFilingDate \@ "MMMM dd, yyyy"} }



.

  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default IF THEN ELSE CODE

When the field NationalFilingDate is blank, it produces this result:
12:00:00
AM.
Because of this, I am assuming that ApplicationDate won't be produced
because the field is not actually blank, right?


Correct. But you should be OK with

{ IF { MERGEFIELD NationalFilingDate }= "12:00:00 AM" "{ MERGEFIELD
ApplicationDate \@"MMMM dd, yyyy" }" "{ MERGFIELD NationalFilingDate
\@"MMMM dd, yyyy"}" }

Or if it's "12:00:00 AM."

use

{ IF { MERGEFIELD NationalFilingDate }= "12:00:00 AM." "{ MERGEFIELD
ApplicationDate \@"MMMM dd, yyyy" }" "{ MERGFIELD NationalFilingDate
\@"MMMM dd, yyyy"}" }

Longer term, be aware that if for example you change the way you connect
to your data source, the result of { MERGEFIELD NationalFilingDate } may
no longer be the same, and you would need to change the comparand.

Peter Jamieson

http://tips.pjmsn.me.uk

On 28/04/2010 16:43, manatee08 wrote:
When the field NationalFilingDate is blank, it produces this result: 12:00:00
AM.
Because of this, I am assuming that ApplicationDate won't be produced
because the field is not actually blank, right?

Using the code above, when the NationalFilingDate has no date in the field,
the ApplicationDate has today's date rather than the ApplicationDate, which
by itself produces 10/15/2008.



"Graham Mayor" wrote:

Are you sure that a blank record entry actually does produce a blank? Insert
the field on its own and see what it produces, then trap that. Otherwise
apart from the smart quotes it looks OK.

Personally I would quote the alternative options also

{ IF { MERGEFIELD NationalFilingDate }= "" "{ MERGEFIELD ApplicationDate \@
"MMMM dd, yyyy" }" "{ MERGFIELD NationalFilingDate \@ "MMMM dd, yyyy"}" }

--

Graham Mayor - Word MVP

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



m wrote in message
...
Can someone please tell me what is wrong with this code. What I am trying
to
do is:

IF NationalFilingDate field is blank, THEN input the ApplicationDate ELSE
input the NationalFilingDate using the format of MMMM dd, yyyy. This is
the
code that I have so far:

{ IF { MERGEFIELD NationalFilingDate }= "" { MERGEFIELD ApplicationDate \@
"MMMM dd, yyyy" } { MERGFIELD NationalFilingDate \@ "MMMM dd, yyyy"} }



.

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
Can Word 2007 apply a zip code bar code to envelopes? LINDA Microsoft Word Help 4 January 5th 08 04:45 AM
My code isn't showing in code view ruthnann Microsoft Word Help 2 September 8th 07 09:16 PM
lost 25 digit code but have 20 digit cert of auth code dan666666 Microsoft Word Help 1 June 25th 07 03:14 PM
How can I see a text code, such as the code for 'line return'? Blackhawk Microsoft Word Help 3 January 26th 06 09:15 PM
Microworks asks for a code tahat I do not know. How do I get code Francisco Microsoft Word Help 1 November 23rd 05 09:01 PM


All times are GMT +1. The time now is 02:46 PM.

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

About Us

"It's about Microsoft Word"