Group:  Microsoft Word » microsoft.public.word.mailmerge.fields
Thread: Mail Merge - If statement

Geek News

Mail Merge - If statement
Nieve 8/2/2006 11:25:01 AM
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

RE: Mail Merge - If statement
Dave Shaw 8/2/2006 11:57:01 AM
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:

[Quoted Text]
> 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
>
RE: Mail Merge - If statement
Nieve 8/2/2006 1:36:02 PM
Hi Dave

Thanks a mil.

That worked great!

Nieve



"Dave Shaw" wrote:

[Quoted Text]
> 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
> >
RE: Mail Merge - If statement
Nieve 8/2/2006 1:41:02 PM
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:

[Quoted Text]
> 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
> >
RE: Mail Merge - If statement
Dave Shaw 8/2/2006 3:48:01 PM

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:

[Quoted Text]
> 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
> > >
RE: Mail Merge - If statement
Noel 10/13/2008 8:44:07 PM
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:

[Quoted Text]
>
> 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
> > > >
Re: Mail Merge - If statement
Elijah Taylor <pitpawten[ at ]gmail.com> 10/13/2008 9:45:09 PM
Noel wrote:
[Quoted Text]
> 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.

*snip*

I would probably do this by creating a query in Access which did the
same thing, and then setting up my Mail-Merge off the newly created
query. Just another way to do it, sorry if its not applicable to your
situation.

--
Elijah Taylor

Re: Mail Merge - If statement
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 10/13/2008 10:23:45 PM
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" <Noel[ at ]discussions.microsoft.com> wrote in message
news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
[Quoted Text]
>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
>> > > >


Re: Mail Merge - If statement
Noel 10/14/2008 4:34:17 PM
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:

[Quoted Text]
> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
> >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
> >> > > >
>
>
>
Re: Mail Merge - If statement
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 10/14/2008 7:21:07 PM
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" <Noel[ at ]discussions.microsoft.com> wrote in message
news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
[Quoted Text]
> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
>> >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
>> >> > > >
>>
>>
>>


Re: Mail Merge - If statement
Noel 10/14/2008 7:42:01 PM
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:

[Quoted Text]
> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
> >> >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
> >> >> > > >
> >>
> >>
> >>
>
>
>
Re: Mail Merge - If statement
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 10/15/2008 1:04:02 AM
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" <Noel[ at ]discussions.microsoft.com> wrote in message
news:DE1A3B19-ACF6-4DFB-A85E-B14A529DEB66[ at ]microsoft.com...
[Quoted Text]
> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
>> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> >> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
>> >> >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
>> >> >> > > >
>> >>
>> >>
>> >>
>>
>>
>>


Re: Mail Merge - If statement
Noel 10/20/2008 7:58:00 PM
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:

[Quoted Text]
> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> news:DE1A3B19-ACF6-4DFB-A85E-B14A529DEB66[ at ]microsoft.com...
> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> >> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
> >> >> >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
> >> >> >> > > >
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Re: Mail Merge - If statement
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 10/20/2008 10:15:12 PM
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" <Noel[ at ]discussions.microsoft.com> wrote in message
news:51A4647E-C95F-45AA-B2B6-D11C68983047[ at ]microsoft.com...
[Quoted Text]
> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> news:DE1A3B19-ACF6-4DFB-A85E-B14A529DEB66[ at ]microsoft.com...
>> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> >> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
>> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> >> >> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
>> >> >> >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
>> >> >> >> > > >
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Re: Mail Merge - If statement
Noel 10/21/2008 5:30:00 PM
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:

[Quoted Text]
> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> news:51A4647E-C95F-45AA-B2B6-D11C68983047[ at ]microsoft.com...
> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> news:DE1A3B19-ACF6-4DFB-A85E-B14A529DEB66[ at ]microsoft.com...
> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> >> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
> >> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> >> >> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
> >> >> >> >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
> >> >> >> >> > > >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Re: Mail Merge - If statement
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 10/21/2008 7:47:07 PM
You cannot have spaces in the name of a mergefield. (or maybe you can, but
then you would need to include the field name in "")

--
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" <Noel[ at ]discussions.microsoft.com> wrote in message
news:2AAEC274-8555-4593-950D-7B141F927092[ at ]microsoft.com...
[Quoted Text]
>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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> news:51A4647E-C95F-45AA-B2B6-D11C68983047[ at ]microsoft.com...
>> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> >> news:DE1A3B19-ACF6-4DFB-A85E-B14A529DEB66[ at ]microsoft.com...
>> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> >> >> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
>> >> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> >> >> >> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
>> >> >> >> >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
>> >> >> >> >> > > >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Re: Mail Merge - If statement
Noel 10/21/2008 8:14:06 PM
This database was created by someone that is no longer with the company and
they entered the field names that way. Do I need to correct the field names
in all the tables, queries, etc?

"Doug Robbins - Word MVP" wrote:

[Quoted Text]
> You cannot have spaces in the name of a mergefield. (or maybe you can, but
> then you would need to include the field name in "")
>
> --
> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> news:2AAEC274-8555-4593-950D-7B141F927092[ at ]microsoft.com...
> >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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> news:51A4647E-C95F-45AA-B2B6-D11C68983047[ at ]microsoft.com...
> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> >> news:DE1A3B19-ACF6-4DFB-A85E-B14A529DEB66[ at ]microsoft.com...
> >> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> >> >> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
> >> >> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> >> >> >> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
> >> >> >> >> >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
> >> >> >> >> >> > > >
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
Re: Mail Merge - If statement
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 10/21/2008 9:53:31 PM
Try using

{IF {MERGEFIELD "Type_of_Purchase" }="Buy Back" {MERGEFIELD "Total_Cost"}

Using the mail merge helper/wizard, if you select a field from the data
source for which the name includes spaces, it automatically replaces the
space with an underscore and encloses the (modified) field name in quotation
marks.

--
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" <Noel[ at ]discussions.microsoft.com> wrote in message
news:B7BC7317-73D3-4B35-A299-181B4EF9B3FD[ at ]microsoft.com...
[Quoted Text]
> This database was created by someone that is no longer with the company
> and
> they entered the field names that way. Do I need to correct the field
> names
> in all the tables, queries, etc?
>
> "Doug Robbins - Word MVP" wrote:
>
>> You cannot have spaces in the name of a mergefield. (or maybe you can,
>> but
>> then you would need to include the field name in "")
>>
>> --
>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> news:2AAEC274-8555-4593-950D-7B141F927092[ at ]microsoft.com...
>> >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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> >> news:51A4647E-C95F-45AA-B2B6-D11C68983047[ at ]microsoft.com...
>> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> >> >> news:DE1A3B19-ACF6-4DFB-A85E-B14A529DEB66[ at ]microsoft.com...
>> >> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> >> >> >> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
>> >> >> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> >> >> >> >> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
>> >> >> >> >> >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
>> >> >> >> >> >> > > >
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>


Re: Mail Merge - If statement
crae 12/22/2008 7:29:02 PM
Doug,

I'm afraid this Service Purchase mail merge letter has now been passed over
to me. Again, using the same Access Database. Need to change an IF
statement merge field. I thought I had come upon something that would work
but it's not giving me results that I would expect. Could be my syntax is
off? I've scanned your previous threads and have tried breaking it down and
doing the Toggle Field Codes for the sections. I'll copy in what I'm seeing.

My current code:
IF {MERGEFIELD TypeofPurchase } = "Buy In" { MERGEFIELD Qtrs_to_Purchase }
"IF { MERGEFIELD TypeofPurchase } = "Buy Up" { MERGEFIELD Qtrs_to_Purchase
}" "0"} "}

Basically if TypeofPurchase is either Buy In or Buy Up, it needs to pull the
data from the same Qtrs_to_Purchase field, otherwise 0.

When I do the toggle field codes for the first line, it gives me this (keep
in mind that on this mail merge I'm working with the TypeofPurchase field in
our database was displaying Buy Up);

«TypeofPurchase» = "Buy In" 0
When I do the toggle field codes for the second line, it gives me this;
IF { MERGEFIELD TypeofPurchase } =
When I do the toggle field code for the entire thing, it gives me the same
thing as listed directly above.

This field was originally only populated with the first statement, but due
to a requested change, it needs to incorporate whether it's either a Buy In
OR a Buy Up.

Hope you can offer some suggestions.

Thank you in advance for your time/assistance,
crae

"Doug Robbins - Word MVP" wrote:

[Quoted Text]
> Try using
>
> {IF {MERGEFIELD "Type_of_Purchase" }="Buy Back" {MERGEFIELD "Total_Cost"}
>
> Using the mail merge helper/wizard, if you select a field from the data
> source for which the name includes spaces, it automatically replaces the
> space with an underscore and encloses the (modified) field name in quotation
> marks.
>
> --
> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> news:B7BC7317-73D3-4B35-A299-181B4EF9B3FD[ at ]microsoft.com...
> > This database was created by someone that is no longer with the company
> > and
> > they entered the field names that way. Do I need to correct the field
> > names
> > in all the tables, queries, etc?
> >
> > "Doug Robbins - Word MVP" wrote:
> >
> >> You cannot have spaces in the name of a mergefield. (or maybe you can,
> >> but
> >> then you would need to include the field name in "")
> >>
> >> --
> >> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> news:2AAEC274-8555-4593-950D-7B141F927092[ at ]microsoft.com...
> >> >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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> >> news:51A4647E-C95F-45AA-B2B6-D11C68983047[ at ]microsoft.com...
> >> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> >> >> news:DE1A3B19-ACF6-4DFB-A85E-B14A529DEB66[ at ]microsoft.com...
> >> >> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> >> >> >> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
> >> >> >> >> > 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> >> >> >> >> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
> >> >> >> >> >> >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
Re: Mail Merge - If statement
Peter Jamieson <pjj[ at ]KillMAPSpjjnet.demon.co.uk> 12/22/2008 8:40:17 PM


As posted, your code has various brace and/or quote characters either
absent or in excess. Your code should look more like this - none of the
newlines I have added need to be there - they are just to try to make
the structure clearer. I would suggest that you re-enter the code from
scratch (don't try to start with the existing stuff), and make sure you
select it and update all the fields using F9 before testing.

{
IF { MERGEFIELD TypeofPurchase } = "Buy In"
"{ MERGEFIELD Qtrs_to_Purchase }"
"{
IF { MERGEFIELD TypeofPurchase } = "Buy Up"
"{ MERGEFIELD Qtrs_to_Purchase }"
"0"
}"
}

You could probably get away with fewer quotes e.g.


{
IF { MERGEFIELD TypeofPurchase } = "Buy In"
{ MERGEFIELD Qtrs_to_Purchase }
{
IF { MERGEFIELD TypeofPurchase } = "Buy Up"
{ MERGEFIELD Qtrs_to_Purchase }
"0"
}
}

but personally I prefer to spell it all out as follows:

{
IF "{ MERGEFIELD TypeofPurchase }" = "Buy In"
"{ MERGEFIELD Qtrs_to_Purchase }"
"{
IF "{ MERGEFIELD TypeofPurchase }" = "Buy Up"
"{ MERGEFIELD Qtrs_to_Purchase }"
"0"
}"
}


Don't forget that every pair of {} needs to be the special field code
braces that you can enter with ctrl-F9


Peter Jamieson

http://tips.pjmsn.me.uk

crae wrote:
[Quoted Text]
> Doug,
>
> I'm afraid this Service Purchase mail merge letter has now been passed over
> to me. Again, using the same Access Database. Need to change an IF
> statement merge field. I thought I had come upon something that would work
> but it's not giving me results that I would expect. Could be my syntax is
> off? I've scanned your previous threads and have tried breaking it down and
> doing the Toggle Field Codes for the sections. I'll copy in what I'm seeing.
>
> My current code:
> IF {MERGEFIELD TypeofPurchase } = "Buy In" { MERGEFIELD Qtrs_to_Purchase }
> "IF { MERGEFIELD TypeofPurchase } = "Buy Up" { MERGEFIELD Qtrs_to_Purchase
> }" "0"} "}
>
> Basically if TypeofPurchase is either Buy In or Buy Up, it needs to pull the
> data from the same Qtrs_to_Purchase field, otherwise 0.
>
> When I do the toggle field codes for the first line, it gives me this (keep
> in mind that on this mail merge I'm working with the TypeofPurchase field in
> our database was displaying Buy Up);
>
> «TypeofPurchase» = "Buy In" 0
> When I do the toggle field codes for the second line, it gives me this;
> IF { MERGEFIELD TypeofPurchase } =
> When I do the toggle field code for the entire thing, it gives me the same
> thing as listed directly above.
>
> This field was originally only populated with the first statement, but due
> to a requested change, it needs to incorporate whether it's either a Buy In
> OR a Buy Up.
>
> Hope you can offer some suggestions.
>
> Thank you in advance for your time/assistance,
> crae
>
> "Doug Robbins - Word MVP" wrote:
>
>> Try using
>>
>> {IF {MERGEFIELD "Type_of_Purchase" }="Buy Back" {MERGEFIELD "Total_Cost"}
>>
>> Using the mail merge helper/wizard, if you select a field from the data
>> source for which the name includes spaces, it automatically replaces the
>> space with an underscore and encloses the (modified) field name in quotation
>> marks.
>>
>> --
>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>> news:B7BC7317-73D3-4B35-A299-181B4EF9B3FD[ at ]microsoft.com...
>>> This database was created by someone that is no longer with the company
>>> and
>>> they entered the field names that way. Do I need to correct the field
>>> names
>>> in all the tables, queries, etc?
>>>
>>> "Doug Robbins - Word MVP" wrote:
>>>
>>>> You cannot have spaces in the name of a mergefield. (or maybe you can,
>>>> but
>>>> then you would need to include the field name in "")
>>>>
>>>> --
>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>>>> news:2AAEC274-8555-4593-950D-7B141F927092[ at ]microsoft.com...
>>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>>>>>> news:51A4647E-C95F-45AA-B2B6-D11C68983047[ at ]microsoft.com...
>>>>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>>>>>>>> news:DE1A3B19-ACF6-4DFB-A85E-B14A529DEB66[ at ]microsoft.com...
>>>>>>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>>>>>>>>>> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
>>>>>>>>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>>>>>>>>>>>> news:37E343ED-E98D-436C-B360-ED2CD84C7C08[ at ]microsoft.com...
>>>>>>>>>>>>> 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
Re: Mail Merge - If statement
crae 12/22/2008 11:00:14 PM
Peter,

Thank you for the quick reply. Wow. Your suggestions and examples worked
well. Part of my hang up was not using the ctrl+F9 to create the brackets,
even before the IF word. You said in your reply to watch out for this.
Rightly so.

I'm not getting the exact data qty I was expecting but will look into that
some more on my end (atleast it IS stating 0 which was my default if the
criteria wasn't met). You have my formula working well - all parts are in
place. Thank you Peter.

Can I ask another question? Within this merge letter, there is a merge
field titled Due_Date. I'm expecting the data to come in with the following
format 12/22/08. Currently it's displaying 2009-06-16 00:00:00
The Due Date field in the Access Database is not formatted like that, why
does it display in Word like that?

Thanks for all your time/trouble. You've already made my holidays happier.
.. .I'd been wrestling with that syntax for a week now. It must be fun to
know so much about particular things.

crae

"Peter Jamieson" wrote:

[Quoted Text]
>
>
> As posted, your code has various brace and/or quote characters either
> absent or in excess. Your code should look more like this - none of the
> newlines I have added need to be there - they are just to try to make
> the structure clearer. I would suggest that you re-enter the code from
> scratch (don't try to start with the existing stuff), and make sure you
> select it and update all the fields using F9 before testing.
>
> {
> IF { MERGEFIELD TypeofPurchase } = "Buy In"
> "{ MERGEFIELD Qtrs_to_Purchase }"
> "{
> IF { MERGEFIELD TypeofPurchase } = "Buy Up"
> "{ MERGEFIELD Qtrs_to_Purchase }"
> "0"
> }"
> }
>
> You could probably get away with fewer quotes e.g.
>
>
> {
> IF { MERGEFIELD TypeofPurchase } = "Buy In"
> { MERGEFIELD Qtrs_to_Purchase }
> {
> IF { MERGEFIELD TypeofPurchase } = "Buy Up"
> { MERGEFIELD Qtrs_to_Purchase }
> "0"
> }
> }
>
> but personally I prefer to spell it all out as follows:
>
> {
> IF "{ MERGEFIELD TypeofPurchase }" = "Buy In"
> "{ MERGEFIELD Qtrs_to_Purchase }"
> "{
> IF "{ MERGEFIELD TypeofPurchase }" = "Buy Up"
> "{ MERGEFIELD Qtrs_to_Purchase }"
> "0"
> }"
> }
>
>
> Don't forget that every pair of {} needs to be the special field code
> braces that you can enter with ctrl-F9
>
>
> Peter Jamieson
>
> http://tips.pjmsn.me.uk
>
> crae wrote:
> > Doug,
> >
> > I'm afraid this Service Purchase mail merge letter has now been passed over
> > to me. Again, using the same Access Database. Need to change an IF
> > statement merge field. I thought I had come upon something that would work
> > but it's not giving me results that I would expect. Could be my syntax is
> > off? I've scanned your previous threads and have tried breaking it down and
> > doing the Toggle Field Codes for the sections. I'll copy in what I'm seeing.
> >
> > My current code:
> > IF {MERGEFIELD TypeofPurchase } = "Buy In" { MERGEFIELD Qtrs_to_Purchase }
> > "IF { MERGEFIELD TypeofPurchase } = "Buy Up" { MERGEFIELD Qtrs_to_Purchase
> > }" "0"} "}
> >
> > Basically if TypeofPurchase is either Buy In or Buy Up, it needs to pull the
> > data from the same Qtrs_to_Purchase field, otherwise 0.
> >
> > When I do the toggle field codes for the first line, it gives me this (keep
> > in mind that on this mail merge I'm working with the TypeofPurchase field in
> > our database was displaying Buy Up);
> >
> > «TypeofPurchase» = "Buy In" 0
> > When I do the toggle field codes for the second line, it gives me this;
> > IF { MERGEFIELD TypeofPurchase } =
> > When I do the toggle field code for the entire thing, it gives me the same
> > thing as listed directly above.
> >
> > This field was originally only populated with the first statement, but due
> > to a requested change, it needs to incorporate whether it's either a Buy In
> > OR a Buy Up.
> >
> > Hope you can offer some suggestions.
> >
> > Thank you in advance for your time/assistance,
> > crae
> >
> > "Doug Robbins - Word MVP" wrote:
> >
> >> Try using
> >>
> >> {IF {MERGEFIELD "Type_of_Purchase" }="Buy Back" {MERGEFIELD "Total_Cost"}
> >>
> >> Using the mail merge helper/wizard, if you select a field from the data
> >> source for which the name includes spaces, it automatically replaces the
> >> space with an underscore and encloses the (modified) field name in quotation
> >> marks.
> >>
> >> --
> >> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >> news:B7BC7317-73D3-4B35-A299-181B4EF9B3FD[ at ]microsoft.com...
> >>> This database was created by someone that is no longer with the company
> >>> and
> >>> they entered the field names that way. Do I need to correct the field
> >>> names
> >>> in all the tables, queries, etc?
> >>>
> >>> "Doug Robbins - Word MVP" wrote:
> >>>
> >>>> You cannot have spaces in the name of a mergefield. (or maybe you can,
> >>>> but
> >>>> then you would need to include the field name in "")
> >>>>
> >>>> --
> >>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >>>> news:2AAEC274-8555-4593-950D-7B141F927092[ at ]microsoft.com...
> >>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >>>>>> news:51A4647E-C95F-45AA-B2B6-D11C68983047[ at ]microsoft.com...
> >>>>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >>>>>>>> news:DE1A3B19-ACF6-4DFB-A85E-B14A529DEB66[ at ]microsoft.com...
> >>>>>>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
> >>>>>>>>>> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
> >>>>>>>>>>> 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
Re: Mail Merge - If statement
Peter Jamieson <pjj[ at ]KillMAPSpjjnet.demon.co.uk> 12/22/2008 11:38:28 PM
> Can I ask another question? Within this merge letter, there is a merge
> field titled Due_Date. I'm expecting the data to come in with the
following
> format 12/22/08. Currently it's displaying 2009-06-16 00:00:00
> The Due Date field in the Access Database is not formatted like that,
why
> does it display in Word like that?

There are a number of things to bear in mind when it comes to formatting.

First, Access itself really has two parts - the Access "front end",
which really handles presentation, forms, reports etc., and the
"database engine", which stores and retrieves data. In a simple .mdb,
the database engine is Jet (or ACE in an Access 2007 .accdb), although
Access can use other engines in various ways.

So when you define a date column in an Access table, Jet itself
(probably) will store the column as a date or datetime column, and it
probably does not know anything about the display format you have
defined - i.e. although the formats are defined in Jet tables in the
..mdb, Jet does not know what that data means - only the Access frontend
knows.

(Actually I don't know that that is exactly how Access/Jet treats the
data but it will be something like that)

Second, Word has several different methods for connecting to Access data
- DDE, ODBC, and in Word 2002 and later, OLE DB. DDE was the default
method in Word 2000 and earlier, and OLE DB is the default method in
Word 2002 and later. DDE works by starting Access (if necessary), then
getting Access to open the database and retrieve the data on behalf of
Word. So when Word is using DDE, you may find that data is being
formatted according to the rules that the front end knows about (I can't
remember in this particular case). However, when you use ODBC or OLE DB,
Word does not use Access at all - it uses the Jet or ACE engine
directly. So what you get is what that engine returns.

Typically you can alter the format returned by using a date format
switch in your Word mailmerge document, e.g.

{ MERGEFIELD mydate \[ at ]"MM/DD/YYYY" }

for typical U.S. date format. However, it is as well to ensure that
a. month and day are not reversed in this situation when they are
ambiguous, e.g. 6th July, 7th June
b. null dates are not appearing as if they are real dates.

If you have trouble with these date switches not working, the simplest
fix is probably to write a query in Access that formats the date as a
text string with either the exact format you want, or is formatted as
YYYY-MM-DD . In the latter case, Word's date switches should work as you
expect.

Season's greetings,

Peter Jamieson

http://tips.pjmsn.me.uk

crae wrote:
[Quoted Text]
> Peter,
>
> Thank you for the quick reply. Wow. Your suggestions and examples worked
> well. Part of my hang up was not using the ctrl+F9 to create the brackets,
> even before the IF word. You said in your reply to watch out for this.
> Rightly so.
>
> I'm not getting the exact data qty I was expecting but will look into that
> some more on my end (atleast it IS stating 0 which was my default if the
> criteria wasn't met). You have my formula working well - all parts are in
> place. Thank you Peter.
>
> Can I ask another question? Within this merge letter, there is a merge
> field titled Due_Date. I'm expecting the data to come in with the following
> format 12/22/08. Currently it's displaying 2009-06-16 00:00:00
> The Due Date field in the Access Database is not formatted like that, why
> does it display in Word like that?
>
> Thanks for all your time/trouble. You've already made my holidays happier.
> . .I'd been wrestling with that syntax for a week now. It must be fun to
> know so much about particular things.
>
> crae
>
> "Peter Jamieson" wrote:
>
>>
>> As posted, your code has various brace and/or quote characters either
>> absent or in excess. Your code should look more like this - none of the
>> newlines I have added need to be there - they are just to try to make
>> the structure clearer. I would suggest that you re-enter the code from
>> scratch (don't try to start with the existing stuff), and make sure you
>> select it and update all the fields using F9 before testing.
>>
>> {
>> IF { MERGEFIELD TypeofPurchase } = "Buy In"
>> "{ MERGEFIELD Qtrs_to_Purchase }"
>> "{
>> IF { MERGEFIELD TypeofPurchase } = "Buy Up"
>> "{ MERGEFIELD Qtrs_to_Purchase }"
>> "0"
>> }"
>> }
>>
>> You could probably get away with fewer quotes e.g.
>>
>>
>> {
>> IF { MERGEFIELD TypeofPurchase } = "Buy In"
>> { MERGEFIELD Qtrs_to_Purchase }
>> {
>> IF { MERGEFIELD TypeofPurchase } = "Buy Up"
>> { MERGEFIELD Qtrs_to_Purchase }
>> "0"
>> }
>> }
>>
>> but personally I prefer to spell it all out as follows:
>>
>> {
>> IF "{ MERGEFIELD TypeofPurchase }" = "Buy In"
>> "{ MERGEFIELD Qtrs_to_Purchase }"
>> "{
>> IF "{ MERGEFIELD TypeofPurchase }" = "Buy Up"
>> "{ MERGEFIELD Qtrs_to_Purchase }"
>> "0"
>> }"
>> }
>>
>>
>> Don't forget that every pair of {} needs to be the special field code
>> braces that you can enter with ctrl-F9
>>
>>
>> Peter Jamieson
>>
>> http://tips.pjmsn.me.uk
>>
>> crae wrote:
>>> Doug,
>>>
>>> I'm afraid this Service Purchase mail merge letter has now been passed over
>>> to me. Again, using the same Access Database. Need to change an IF
>>> statement merge field. I thought I had come upon something that would work
>>> but it's not giving me results that I would expect. Could be my syntax is
>>> off? I've scanned your previous threads and have tried breaking it down and
>>> doing the Toggle Field Codes for the sections. I'll copy in what I'm seeing.
>>>
>>> My current code:
>>> IF {MERGEFIELD TypeofPurchase } = "Buy In" { MERGEFIELD Qtrs_to_Purchase }
>>> "IF { MERGEFIELD TypeofPurchase } = "Buy Up" { MERGEFIELD Qtrs_to_Purchase
>>> }" "0"} "}
>>>
>>> Basically if TypeofPurchase is either Buy In or Buy Up, it needs to pull the
>>> data from the same Qtrs_to_Purchase field, otherwise 0.
>>>
>>> When I do the toggle field codes for the first line, it gives me this (keep
>>> in mind that on this mail merge I'm working with the TypeofPurchase field in
>>> our database was displaying Buy Up);
>>>
>>> «TypeofPurchase» = "Buy In" 0
>>> When I do the toggle field codes for the second line, it gives me this;
>>> IF { MERGEFIELD TypeofPurchase } =
>>> When I do the toggle field code for the entire thing, it gives me the same
>>> thing as listed directly above.
>>>
>>> This field was originally only populated with the first statement, but due
>>> to a requested change, it needs to incorporate whether it's either a Buy In
>>> OR a Buy Up.
>>>
>>> Hope you can offer some suggestions.
>>>
>>> Thank you in advance for your time/assistance,
>>> crae
>>>
>>> "Doug Robbins - Word MVP" wrote:
>>>
>>>> Try using
>>>>
>>>> {IF {MERGEFIELD "Type_of_Purchase" }="Buy Back" {MERGEFIELD "Total_Cost"}
>>>>
>>>> Using the mail merge helper/wizard, if you select a field from the data
>>>> source for which the name includes spaces, it automatically replaces the
>>>> space with an underscore and encloses the (modified) field name in quotation
>>>> marks.
>>>>
>>>> --
>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>>>> news:B7BC7317-73D3-4B35-A299-181B4EF9B3FD[ at ]microsoft.com...
>>>>> This database was created by someone that is no longer with the company
>>>>> and
>>>>> they entered the field names that way. Do I need to correct the field
>>>>> names
>>>>> in all the tables, queries, etc?
>>>>>
>>>>> "Doug Robbins - Word MVP" wrote:
>>>>>
>>>>>> You cannot have spaces in the name of a mergefield. (or maybe you can,
>>>>>> but
>>>>>> then you would need to include the field name in "")
>>>>>>
>>>>>> --
>>>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>>>>>> news:2AAEC274-8555-4593-950D-7B141F927092[ at ]microsoft.com...
>>>>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>>>>>>>> news:51A4647E-C95F-45AA-B2B6-D11C68983047[ at ]microsoft.com...
>>>>>>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>>>>>>>>>> news:DE1A3B19-ACF6-4DFB-A85E-B14A529DEB66[ at ]microsoft.com...
>>>>>>>>>>> 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" <Noel[ at ]discussions.microsoft.com> wrote in message
>>>>>>>>>>>> news:692153D9-2DC0-4E11-8FD8-D1723BA2109B[ at ]microsoft.com...
>>>>>>>>>>>>> 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

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net