View Single Post
  #15   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Noel Noel is offline
external usenet poster
 
Posts: 30
Default Mail Merge - If statement

I entered it in the Word Merge document as {IF {MERGEFIELD Type of
Purchase}="Buy Back" {MERGEFIELD Total Cost} but I get an error saying that
Type is not in my data source.



"Doug Robbins - Word MVP" wrote:

You do not need to be using anything like "Select * from SERVICEPURCHASE
Where TYPE OF PURCHASE =Buy In"

As I said in one of my earlier posts:

To do it in the mailmerge main document, in the where you have (or would
have the Buy Back) merge field, use

{ IF { MERGEFIELD PurchaseType } = "Buy Back" { MERGEFIELD Amount } }

and where you have (or would have the Buy In) merge field, use

{ IF { MERGEFIELD "PurchaseType } = "Buy In" { MERGEFIELD Amount } }

or something similar. You must use Ctrl+F9 to insert each pair of field
delimiters { }.


--
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

"Noel" wrote in message
...
Would I try something like this and put it in the toggle field codes in
the
Word document "Select * from SERVICEPURCHASE Where TYPE OF PURCHASE =Buy
In"
? The end result, I need it to place the TOTAL COST in the Buy In field of
the Merge letter. If it's a Buy Back, I need it to be placed in the Buy
Back
field of the Merge Letter. Nobody else in my office knows access and so
I'm
sorry if I am a little clueless with this. I'm on a time crunch to get
this
done, so using all I can.

Thanks so much for your help!


"Doug Robbins - Word MVP" wrote:

The PurchaseType field from Access can be used as a Mergefield in the way
detailed in the If...then...Else field construction, without having the
actual content of the field appear anywhere in the merge document.

Normally, I would say that manipulation such as that done by the use of
If...then...Else fields is best done in the data source if that source is
a
data base. However, I understand from your original post that you want
the
contents of an amount field to appear in different places in the letter
depending upon the PurchaseType.

Without seeing the actual context of where you want this information to
appear, it is difficult to tell you the best way to go about it.

--
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

"Noel" wrote in message
news It is a field within the Access database but it is not something that
gets
merged into the letter in Word. Maybe this should be something in the
Access
query?
I'm a newbie to the statements that you can use so I am seeking any
help i
can get.
Thanks

"Doug Robbins - Word MVP" wrote:

If the Purchase Type is not a mergefield, from where does it come?

--
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

"Noel" wrote in message
...
The purchase type is not a merge field, so my question would be is
what
do
I
code the field code?
Thanks
"Doug Robbins - Word MVP" wrote:

To do it in the mailmerge main document, in the where you have (or
would
have the Buy Back) merge field, use

{ IF { MERGEFIELD PurchaseType } = "Buy Back" { MERGEFIELD
Amount } }

and where you have (or would have the Buy In) merge field, use

{ IF { MERGEFIELD "PurchaseType } = "Buy In" { MERGEFIELD
Amount } }

or something similar. You must use Ctrl+F9 to insert each pair of
field
delimiters { }.

--
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

"Noel" wrote in message
...
I have a mail merge letter that pulls information from an access
database.
I
need to put in an IF statement that says if the type of purchase
is
buy
back,
then it is to mail merge the amount in the Buy Back merge field,
if
it's a
Buy In, then it needs to merge it into the Buy In merge field.
The
amounts
pull from the same field in access.

Thanks

"Dave Shaw" wrote:


The mergefields that you are doing the conditional argument on
and
the
result would normally be the same. By putting in a line break at
the
end
of
the 'else' part will result in an additional line break if this
condition
is
met.

Anyway glad to be of help


"Nieve" wrote:

Hi.

I actually had to fiddle around with the code.

The correct code is

{ IF {MERGEFIELD Contact Name} = "No Contact" "The Manager"
"{MERGEFIELD
"Contact Name"}
"}

It worked great anyhow!

Nieve






"Dave Shaw" wrote:

I would suggest that you insert a field code such as:

{ IF {MERGEFIELD Contact Name} = "No Contact" "The Manager"
"{MERGEFIELD
Contact Name}"}

To do the above ensure you can see field codes - Tools,
Options,
view, field
codes, and insert the {} using Ctrl + F9

Hope this helps

Dave

"Nieve" wrote:

Hi

I have a mail merge letter to send to potential clients.

Some of the data in one merge field (Contact Name) is
'No
Contact'. I
want to set a rule in the mail merge template that says
when
the
data 'No
Contact' is merged it is replaced with 'The Manager'. Is
there a
way of doing
this?


(I know I could do Find and Replace ('No Contact' with
'The
Manager') in
excel (where the data is stored), or when the mail merge
is
completed. This
is not a solution however, as I simply need the template
to
do
it
for me).

Thanks

Nieve