merge to word from access

J

JERRY

When I merge to word from access and want to access a YES-
NO field from ACCESS, I can not seem to get the right
syntac for doing an IF-THEN in the word merge field codes.

I have tried IF TRUE then "Yes" (Otherwise) "NO"
I have trie IF -1
I have tried IF YES
none of them gives the proper merge results

Suggestions needed and welcome
Thank you
 
P

Peter Jamieson

Typically the following will work:

{ IF { MERGEFIELD myfield } = 0 "No" "Yes" }
 
J

JERRY

Yes, thank you,
that is EXACTLY what I tried---and, I tried it again--
but the merge produces YES as the response for **every**
record.

Stumped.
JERRY
 
P

Peter Jamieson

OK, what is the result of

{ MERGEFIELD myfield }

on its own, for Yes and No values?

(and just to be sure, you are using the special field code braces for all
the pairs of {}, and you have got spaces either side of the "=" sign?)
 
J

JERRY

Yes, mergefield by itself yielded the correct answer in
true or false terms.

By looking areound the web and by applying an example I
saw I found a fix that works!

I don't have the document here, as I am now home, but it
basically consisted of embeding the bracked statement
{ mergefield myfield } inside of another set of brackets
and putting an equal sign in front, something like this:
{ {= {mergefield myfield }} 0 "No." "Yes." }
 
P

Peter Jamieson

In essence, whatever the Mergefield returns is what you need to test in your
{ IF } field.

The problem here is that Yes/No fields appear differently depending on which
method Word is using to connect to Access (and they may also depend on the
version of Access or the Jet database engine). This is complicated by the
fact that the default connection method changed from DDE to OLEDB in Word
2002.

The { = } approach is probably something like

{ IF {= { MERGEFIELD myfield } } = 0 "No." "Yes." }

It should not be necessary to have the { = } field but since there is no
published specification of the "field language" in the end the only
specification available is "if it works, it works" :)
 
C

Cindy Meister -WordMVP-

Hi Jerry,
Yes, mergefield by itself yielded the correct answer in
true or false terms.
Which version of Word is this, and which connection method
are you using to the data?

I noticed that Access 2002 tends to send literal Yes and No
(or True False) rather than 0 and 1/-1, as earlier versions
used to...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jan 24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

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