Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / May 2007

Tip: Looking for answers? Try searching our database.

IF Statement Hierarchy - Word 2000

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Stammers - 15 May 2007 12:55 GMT
Hello,

Is there a hierarchy in an IF statement? I ask because I have a mailmerge
that is looking at certain criteria to generate a particular letter version
if that criteria is met, so it says { IF { MERGEFIELD field1 } = 2 "{ IF
{MERGEFIELD field2 } = 1 "LETTER" "" }" }

I should say, that within the merge, there are 2 variations of the above,
the other being { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 } <>
1 "LETTER2" "" }" }

There are then queries within the paragraphs of the letters to determine
what the paragraph should say and various formatting queries. It works - kind
of - but in the first version it also seems to be generating the letter where
the second field ISN'T '1', and dropping out part of one of the paragraphs.
It shouldn't be generating at all! HELP, it's driving me mad! (I hope this
all makes some sort of sense.......)

Thanks,
Chris
Chris Stammers - 15 May 2007 16:18 GMT
Hello,

Please ignore this last question; I have since sorted the problem out.
However, do things like Continuous Breaks and the position the query is
placed in the document have an effect on whether or not a merge will work? I
have a query I got from Peter and Graham to format currency to remove the
decimal point from a pence figure. This is on one document in several places
and works fine, but I have have it in another document where it is only used
once and the document generates with 'Field Calculation Error occurred in
record 1' etc.

Does anyone have any thoughts?

Thanks,
Chris

Thanks,
Chris

> Hello,
>
[quoted text clipped - 16 lines]
> Thanks,
> Chris
Peter Jamieson - 15 May 2007 16:30 GMT
> However, do things like Continuous Breaks and the position the query is
> placed in the document have an effect on whether or not a merge will work?

No, except
a. in the obvious sense that you want the results to be laid out how they
need to be laid out :-)
b. putting breaks in the middle of a field name (for example) is probably
not going to work.

> once and the document generates with 'Field Calculation Error occurred in
> record 1' etc.

Can you see the value of the number that seems to cause the problem?

Peter Jamieson

> Hello,
>
[quoted text clipped - 44 lines]
>> Thanks,
>> Chris
Peter Jamieson - 15 May 2007 16:33 GMT
BTW I would call \#"00p" a "query" - these things are normally called by
other jargon expressions, e.g. "numeric switch" or "numeric picture switch".

Peter Jamieson

> Hello,
>
[quoted text clipped - 44 lines]
>> Thanks,
>> Chris
Peter Jamieson - 15 May 2007 16:23 GMT
At the moment I can't see anything wrong with either of the IF fields :-(
Personally I would always put the other result in (a "" before the final
"}" ) but I don't think it should make any difference).

But what exactly is in the field where you have put "LETTER" ? Is it
literallyt the word LETTER, a set of fields and text, an INCLUDETEXT, or
what (If you have used an INCLUDETEXT, then there could be a problem)

Peter Jamieson

> Hello,
>
[quoted text clipped - 21 lines]
> Thanks,
> Chris
Chris Stammers - 15 May 2007 16:31 GMT
It is a complete letter. I just put 'LETTER' for ease of explanation (!).
This is now working after a bit of playing about.

Thanks,
Chris

> At the moment I can't see anything wrong with either of the IF fields :-(
> Personally I would always put the other result in (a "" before the final
[quoted text clipped - 31 lines]
> > Thanks,
> > Chris
Doug Robbins - Word MVP - 15 May 2007 16:26 GMT
In the case of { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 } = 1
"LETTER" "" }" }

field1 would be evaluated and if it equals 2, then Field 2 would be
evaluated.   If it equals one, the word "LETTER" would be inserted.  If
neither condition is met, nothing would be inserted.

Note, you do not need the quote marks around

{ IF {MERGEFIELD field2 } = 1 "LETTER" "" }

Are you sure that the fields always contain numeric values?

Signature

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

> Hello,
>
[quoted text clipped - 21 lines]
> Thanks,
> Chris
Chris Stammers - 15 May 2007 16:41 GMT
There is a mix of fields in the AS400 data source however what I was trying
to get to was IF MERGEFIELD field1 = 2 AND field2 = 1, then insert the
appropriate letter, otherwise don't do anything and move on to the next query
in the document which, if I understand correctly, is what you are saying.
After quite exhaustive testing, this is now working.

> In the case of { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 } = 1
> "LETTER" "" }" }
[quoted text clipped - 34 lines]
> > Thanks,
> > Chris

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.