if then type question

G

Glenn

I am creating a membership directory.

All members will have their name and address published. However, they have
been given the option to have their email and/or phone number published.

My database contains the following pieces of information:

Name
Address
Email
PublishEmail
Phone
PublishPhone


The PublishEmail and PublishPhone fields contain either "Yes" or "No".

How can I set my document up so that if PublishEmail = Yes then it will
print the Email address from the Email field?

Thanks,
Glenn
 
G

Graham Mayor

{IF {Mergefield PublishEmail} = "Yes" "{Mergefield Email}"}


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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Glenn

Thanks, but where do I put that? When I copy and paste it from here it just
shows up as text.
 
D

Doug Robbins

You must use Ctrl+F9 to insert the field delimiters { }. You cannot insert
them using those keys on the keyboard.

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

Glenn

That worked great, thank you!

Next question - if the field is "No" so that the e-mail address isn't
published, how do I get to avoid entering a blank line?

For instance when I do the merge using the commands you taught me about, I
get:

Whata Member
(e-mail address removed)
555-1213

John Doe

555-1212


where as since John chose not to have his e-mail published, I'd like him to
show up as:

John Doe
555-1212
 
D

Doug Robbins

{IF {Mergefield PublishEmail} = "Yes" {Mergefield Email} {Mergefield
NextMergefield }}

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

Glenn

When I try that I get the "Invalid Merge Field" popup box. It says this
mergefield (NextMergefield) is used in the main document, but it does not
exist in the data source.

Also, once I click the button to view the data, I can't figure out how to
get back to a place where I can edit the place where I put the merge fields
in using CTRL F9 and typing the info in. I've tried view all but that
doesn't seem to work.
 
G

Graham Mayor

You need to insert the line break into the result of the conditional field
eg

{Mergefield Name}{IF {Mergefield PublishEmail} <> "" "
{Mergefield Email}"}{IF Mergefield PublishPhone} <> "" "
{Mergefield Phone}"}
 
G

Glenn

What I am trying to do is prevent a blank line from showing up if the e-mail
isn't to be listed.
 
G

Graham Mayor

See my other answer in this thread.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

Doug Robbins

On line 1:

{IF {Mergefield PublishEmail} = "Yes" {Mergefield Email} { IF {Mergefield
PublishPhone} = "Yes" { Mergefield Phone}}""}

On line 2:

{IF {Mergefield PublishEmail} = "Yes" { IF{Mergefield PublishPhone} = "Yes"
{ Mergefield Phone} "" }}}

Line 1 checks to see if the email is to be published. If it is, it inserts
the email address. If it isn't, it checks if the phone is to be pubished.
If it is, it inserts the phone number. If neither are to be published,
neither is inserted.

Line 2 checks ot see if the email was published (in which case the phone
would not have been published by line 1), then it checks to see if the phone
is to be published and if it is, it inserts the phone number. If the phone
is not to be published, nothing is inserted.
--
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