Link to home
Start Free TrialLog in
Avatar of cmp119
cmp119Flag for United States of America

asked on

Word Mergefield If-Then-Else Statement

I am trying to conditionally display the spouse2 address if it is different then spouse1 address.  Both spouses are included in the same data record.

For instance, lets say:

Spouse1:  John Smith
Add1       12 Tent Rd
Add2
Add3
City          Atlantic City
State        NJ
ZipCode  075265

Spouse2:  Loretta Smith
Add1        68 Wake Dr
Add2        Suite 3625
Add3
State        Trenton
State        NJ
ZipCode   075155

I am trying to develop a conditional statement based on Add1.  If the same, then blank else print each address.  So if the address it the same I could do the following:

John and Loretta Smith
12 Tent Rd
Atlantic City, NJ 075265

If different address lines, then it should display Spouse1 and Spouse2 with separate name and addresses.  
 
If Spouse1.Add1 = Spouse2.Add1 then ""
Else
Spouse1.Name
Spouse1.Add1 chr(130 +
Spouse1.Add2 chr(13) +
Spouse1.Add3 chr(13) +
Spouse1.City, Spouse1.State, Spouse1.ZipCode 
chr(13)
chr(13)
Spouse2.Name
Spouse2.Add1 chr(130 +
Spouse2.Add2 chr(13) +
Spouse2.Add3 chr(13) +
Spouse2.City, Spouse2.State, Spouse2.ZipCode

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cmp119

ASKER

This worked!!!! GrahamSkan you are the man!