If statement problems in mail merge

J

jameseyryan

I have a database in Microsoft Access 2003 which i am linkin to word 2003 via
mail merge.

I want to check the answer given in the access form is "Yes". If it is i
want to put in a value from a different mergefield, if not, a blank value. At
the moment my if statment reads like this:

{ IF { MERGEFIELD OneDependent } = "Yes" "{ MERGEFIELD Child1Forename }" "" }

A value of MERGEFIELD is all that appears. There is data in the database for
the fields: "OneDependent" and also for "Child1Forename". What am i doing
wrong?
 
D

Doug Robbins

I would do all of the data manipulation with a Query in Access and then use
that Query as the datasource.

However, I think your problem is that you did not use Ctrl+F9 to insert the
field delimiters around the MERGEFIELD Child1Forename

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

jameseyryan

I can't do a query in access to manipulate the data first as the fild
"Child1Forename" is entered into the document more than once. It is needed in
one place but may not in the place I am having this problem with.

As for using CTRL + F9 for the delimiters, I did that too but no luck either.
 
D

Doug Robbins

That would not preclude you from using a query in Access. You can have the
Child1Forename field in the query as well as any number of conditional
fields that may return the Child1Forename field if the condition is met.

I cannot replicate your problem here when using and If...then...Else field
in a mailmerge main document.

If you want to send me your document, I will take a look at if for you.

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

Peter Jamieson

When you get "YesNo" data from Access, the values you see depend on how you
are connecting to your access/jet data file.

If you are using DDE (the default in Word 2000 and earlier), then "Yes"
shows up in Word as "-1" and the "No" as "0"
If you are using OLEDB (the default in Word 2002/2003) the "Yes" shows up as
"True" and "No" as False"
If you are using ODBC, the "Yes" shos up as "1" and the "No" as "0"

So you need to put the right test, depending on how you are connecting, into
your IF field, e.g.

{ IF { MERGEFIELD Child1Forename } = 0 "the 'no' result" "the 'yes'
result" }

unless you're using OLEDB in which case you need


{ IF { MERGEFIELD Child1Forename } = "False" "the 'no' result" "the 'yes'
result" }

Peter Jamieson
 
D

Doug Robbins

Another reason for doing the data manipulation in the database<g>

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

Peter Jamieson

Absolutely.

Peter Jamieson
Doug Robbins said:
Another reason for doing the data manipulation in the database<g>

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

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