View Single Post
  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Suzanne Suzanne is offline
external usenet poster
 
Posts: 53
Default Help with embedded "If"

Thanks! The third one did it (I didn't try the other two). You are correct
in that none of the fields are empty.

I've given up hope on this, but here's one last shot... now that the data is
in Word, is there anyway to automate my Word form with these results? I was
told I couldn't do it straight from Excel.

I have a two-page form with numerous table columns and rows. The UIC,
Building, and Room go on the top of the first page. Names which are
associated with that UIC/Bldg/Room combination go on the second page.

The second page is not in a table format. Rows of names are at the top of
the page.

I'm ready to conclude that despite the great things that Word can do, I may
have to manually align, cut/paste, and validate data on the form I'm required
to use.

Suz

"Peter Jamieson" wrote:

Assuming you're doing a "one-many" type merge
There are at least two problems in your current code:
a. you can't do the AND the way you are trying to do it at the moment
b. you seem to be inserting the same thing whether UIC and ROOM change or
not.

If you only want to test for a change in either UIC or ROOM, you can try

{ IF { MERGESEQ } = "1" "{ SET LUIC "" }{ SET LROOM "" }" ""
}{ If "{ LUIC }{ LROOM }" "{ MERGEFIELD UIC }{ MERGEFIELD ROOM }"
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }whatever you want here
{ SET LUIC { MERGEFIELD UIC } }{ SET LROOM { MERGEFIELD ROOM } }

or perhaps even just

{ IF { MERGESEQ } = "1" "{ SET UICROOM "" }" ""
}{ If "{ UICROOM }" "{ MERGEFIELD UIC }{ MERGEFIELD ROOM }"
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }whatever you want here
{ SET UICROOM "{ MERGEFIELD UIC }{ MERGEFIELD ROOM }" }

If you are trying to check that both UIC and ROOM have changed, try

{ IF { MERGESEQ } = "1" "{ SET LUIC "" }{ SET LROOM "" }" ""
}{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }whatever you want here
{ SET LUIC { MERGEFIELD UIC } }{ SET LROOM { MERGEFIELD ROOM } }

All the above assume that UIC and ROOM are never ""

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
news

I'm trying to merge Excel data to Word based on two values: "UIC" and
"Room"

{IF {MERGESEQ } = 1 ""}
{ SET UIC1 { MERGEFIELD UIC }}
{ SET ROOM1 { MERGEFIELD ROOM }}
{ IF { UIC2 } { UIC1 } { AND { IF { ROOM2 } { ROOM1} }}
"{MERGEFIELD UIC } { MERGEFIELD ROOM } {MERGEFIELD LAST }"
"{MERGEFIELD UIC } { MERGEFIELD ROOM } {MERGEFIELD LAST }"
{ SET UIC2 {MERGEFIELD UIC } {SET ROOM2 {MERGEFIELD ROOM } }}

This is partially working:

- It's skipping records
- Where each skipped record is supposed to be, there's an "Error!
Bookmark not defined" message.