MERGEFIELDS

N

Nathan Franklin

Hello all,

When I do a mail merge with VB, I am trying to update a certain value on my
word document...
It is using an IF field... But on the new merged document it just appears
blank with no value

{ IF{MERGEFIELD PowerConnected } = 1 "Note: Power was connected at time of
inspection." "Note: Power was not connected at time of inspection." }

In the data I am passing PowerConnected does equal 1 ... is there anything
you could suggest....
thanks

Nathan
 
D

Doug Robbins - Word MVP

Most likely the fields in the document need to be updated.

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

Charles Kenyon

Don't know that it matters, but you need a space after IF.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
G

Graham Mayor

This should work as you have it. If you merge the document with
{Mergefield PowerConnected}
what result do you get, when you think you should be getting "1"?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
N

Nathan Franklin

Graham,

I do get the value 1 if I just have that mergefield in the doc.... the
problme is I need to use IF statements to display the applicable thing based
on the value.... I dont get any format errors... But just no value appears
when useing the if statement...

im not sure what to do....
 
N

Nathan Franklin

i have an update on this

when putting this into my document

{ IF {MERGEFIELD PowerConnected } = 1 "Note: Power was connected at time of
inspection." "Note: Power was not connected at time of inspection." \*
MERGEFORMAT }

The value that gets printed when I do a mail merge is "PowerConnected"

the actual merge value (i have checked this) is 1.
Most likely the fields in the document need to be updated.
when and how do I update these fields... before or after the merge??

thanks
nathan
 
D

Doug Robbins - Word MVP

Was the If field constructed using Ctrl+F9 to insert the 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
 
G

Graham Mayor

In that case I have been unable to reproduce the problem here. I have no
idea why this is not working if you have given us all the pertinent
information.

Have you tried it without your macro, by using the field construction in a
merge document and attaching your data file? If that works, it would suggest
that there is a problem with your vba coding.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
N

Nathan Franklin

it was used by inserting the field... (in the Insert menu) and then select
the IF field option...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top