Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
CW CW is offline
external usenet poster
 
Posts: 20
Default When merging from database, ignore certain values

We use Word to produce all the job-control documents from our SQL Server
database, and have many mergefields working in these documents.
However there are occasions when the value in the database is such that we
do not want the merge to take place.
For example in our Customers table we have the value "New Prospect" and if
this has been entered on a job in the database, it will print out on the docs
whenever the mergefield Customer: is used.
I would like to code this mergefield so that if the value is found to be
"New Prospect" it would be ignored and the field would not be populated on
the doc.
I know this is some sort of If statement but I cannot get anything to
work.....help, please!
Many thanks
CW

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default When merging from database, ignore certain values

I think what you need in this case is to insert a nested IF field in your
mail merge main document.

Use Alt-F9 to show/hide the field codes ({ MERGEFIELD CustomerID } etc.) and
ctrl-F9 to insert /every/ pair of the special "field code braces" {} that
surround each field.

In this case, try

{ IF { MERGEFIELD Customer } = "New Prospect" "" "{ MERGEFIELD Customer }" }

Peter Jamieson

"CW" wrote in message
...
We use Word to produce all the job-control documents from our SQL Server
database, and have many mergefields working in these documents.
However there are occasions when the value in the database is such that we
do not want the merge to take place.
For example in our Customers table we have the value "New Prospect" and if
this has been entered on a job in the database, it will print out on the
docs
whenever the mergefield Customer: is used.
I would like to code this mergefield so that if the value is found to be
"New Prospect" it would be ignored and the field would not be populated on
the doc.
I know this is some sort of If statement but I cannot get anything to
work.....help, please!
Many thanks
CW


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
CW CW is offline
external usenet poster
 
Posts: 20
Default When merging from database, ignore certain values

Thanks, Peter, but unfortunately that didn't work - the mergefield failed
completely and nothing at all pulled through...any further thoughts?
Thanks again
CW

"Peter Jamieson" wrote:

I think what you need in this case is to insert a nested IF field in your
mail merge main document.

Use Alt-F9 to show/hide the field codes ({ MERGEFIELD CustomerID } etc.) and
ctrl-F9 to insert /every/ pair of the special "field code braces" {} that
surround each field.

In this case, try

{ IF { MERGEFIELD Customer } = "New Prospect" "" "{ MERGEFIELD Customer }" }

Peter Jamieson

"CW" wrote in message
...
We use Word to produce all the job-control documents from our SQL Server
database, and have many mergefields working in these documents.
However there are occasions when the value in the database is such that we
do not want the merge to take place.
For example in our Customers table we have the value "New Prospect" and if
this has been entered on a job in the database, it will print out on the
docs
whenever the mergefield Customer: is used.
I would like to code this mergefield so that if the value is found to be
"New Prospect" it would be ignored and the field would not be populated on
the doc.
I know this is some sort of If statement but I cannot get anything to
work.....help, please!
Many thanks
CW



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default When merging from database, ignore certain values

It may seem trivial, but...

What result do you get from

{ MERGEFIELD Customer }

?

What result do you get from

{ IF "New Prospect" = "New Prospect" "" "{ MERGEFIELD Customer }" }

What result do you get from

{ IF "xxx" = "New Prospect" "" "{ MERGEFIELD Customer }" }

?

Peter Jamieson
"CW" wrote in message
...
Thanks, Peter, but unfortunately that didn't work - the mergefield failed
completely and nothing at all pulled through...any further thoughts?
Thanks again
CW

"Peter Jamieson" wrote:

I think what you need in this case is to insert a nested IF field in your
mail merge main document.

Use Alt-F9 to show/hide the field codes ({ MERGEFIELD CustomerID } etc.)
and
ctrl-F9 to insert /every/ pair of the special "field code braces" {} that
surround each field.

In this case, try

{ IF { MERGEFIELD Customer } = "New Prospect" "" "{ MERGEFIELD
Customer }" }

Peter Jamieson

"CW" wrote in message
...
We use Word to produce all the job-control documents from our SQL
Server
database, and have many mergefields working in these documents.
However there are occasions when the value in the database is such that
we
do not want the merge to take place.
For example in our Customers table we have the value "New Prospect" and
if
this has been entered on a job in the database, it will print out on
the
docs
whenever the mergefield Customer: is used.
I would like to code this mergefield so that if the value is found to
be
"New Prospect" it would be ignored and the field would not be populated
on
the doc.
I know this is some sort of If statement but I cannot get anything to
work.....help, please!
Many thanks
CW




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
Merging/database management Anthony J. B. Mailmerge 8 June 1st 06 07:00 PM
Merging Works Database file John B Mailmerge 1 January 17th 06 03:33 PM
Merging dollar values into word document - how to format? Doug Mailmerge 1 October 18th 05 09:06 PM
Merging past the specified set values FNORD Mailmerge 5 February 23rd 05 09:25 AM
Merging past specified values?? FNORD Mailmerge 0 February 14th 05 10:13 PM


All times are GMT +1. The time now is 09:48 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"