Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Suzanne Suzanne is offline
external usenet poster
 
Posts: 53
Default Help with embedded "If"


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.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Help with embedded "If"

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.


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



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Help with embedded "If"

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a question of "where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably needs to have
a page break at the end - you can insert one in the result text) and perhaps
you will also need to repeat some of the fields at the beginning of that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

At the moment, my suggestion assumes that the stuff you have in "whatever
you want here" will be output for every record. This is because in this kind
of merge, the first record in the group also usually contains the data for
the first detail record in the group IYSWIM. What I am not sure about in
this case is what you mean by...

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


Can you provide an example of the kind of layout you need to achieve? If you
need to avoid having paragraph marks between each record, you need to
eliminate any paragraph marks in the mail merge main document that would be
output following any of the records, and that probably also means that you
need to insert a page break at the beginning of the "heading texts", e.g.

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"page break{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

If you need to eliminate the page break on page 1, try

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"{ IF { LUIC } "" "page break" "" }{ MERGEFIELD UIC }{ MERGEFIELD
ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

NB, you cannot eeliminate the final paragraph mark on a page, but a
directory merge does not insert that one in the output anyway, i.e. if your
mail merge main document just ha

{ MERGEFIELD UIC }

and nothing else except that final para, your output would have

UIC1UIC2UIC3UIC4...

You may find in practice that this introduces other problems (for one thing,
I hope I have the logic the right way around!) but try it anyway.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
...
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.




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

I can't get this working... I've been able to get new record breaks after
each UIC, but have yet to see just the list of names on the second page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of text)
Second Page: All people with the same UIC and Room (everyone in the room
will have the same building number but not necessarily the same UIC)

I can adjust the first page of the form so that one table cell will contain
UIC, BLDG, ROOM. On the top of the second page, I need a list of names for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to manually Alt-Tab
between two document to cut/paste the information on the forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a question of "where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably needs to have
a page break at the end - you can insert one in the result text) and perhaps
you will also need to repeat some of the fields at the beginning of that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

At the moment, my suggestion assumes that the stuff you have in "whatever
you want here" will be output for every record. This is because in this kind
of merge, the first record in the group also usually contains the data for
the first detail record in the group IYSWIM. What I am not sure about in
this case is what you mean by...

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


Can you provide an example of the kind of layout you need to achieve? If you
need to avoid having paragraph marks between each record, you need to
eliminate any paragraph marks in the mail merge main document that would be
output following any of the records, and that probably also means that you
need to insert a page break at the beginning of the "heading texts", e.g.

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"page break{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

If you need to eliminate the page break on page 1, try

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"{ IF { LUIC } "" "page break" "" }{ MERGEFIELD UIC }{ MERGEFIELD
ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

NB, you cannot eeliminate the final paragraph mark on a page, but a
directory merge does not insert that one in the output anyway, i.e. if your
mail merge main document just ha

{ MERGEFIELD UIC }

and nothing else except that final para, your output would have

UIC1UIC2UIC3UIC4...

You may find in practice that this introduces other problems (for one thing,
I hope I have the logic the right way around!) but try it anyway.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
...
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.






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

After a full day of hopefully waiting for someone to tell me that there is
some method of doing what I need, I'll close this out and get on to
cutting/pasting the data for each record (sigh).

Thanks Peter for your help... Suz

"Suzanne" wrote:

I can't get this working... I've been able to get new record breaks after
each UIC, but have yet to see just the list of names on the second page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of text)
Second Page: All people with the same UIC and Room (everyone in the room
will have the same building number but not necessarily the same UIC)

I can adjust the first page of the form so that one table cell will contain
UIC, BLDG, ROOM. On the top of the second page, I need a list of names for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to manually Alt-Tab
between two document to cut/paste the information on the forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a question of "where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably needs to have
a page break at the end - you can insert one in the result text) and perhaps
you will also need to repeat some of the fields at the beginning of that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

At the moment, my suggestion assumes that the stuff you have in "whatever
you want here" will be output for every record. This is because in this kind
of merge, the first record in the group also usually contains the data for
the first detail record in the group IYSWIM. What I am not sure about in
this case is what you mean by...

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


Can you provide an example of the kind of layout you need to achieve? If you
need to avoid having paragraph marks between each record, you need to
eliminate any paragraph marks in the mail merge main document that would be
output following any of the records, and that probably also means that you
need to insert a page break at the beginning of the "heading texts", e.g.

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"page break{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

If you need to eliminate the page break on page 1, try

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }
{ MERGEFIELD ROOM } } } = 2
"{ IF { LUIC } "" "page break" "" }{ MERGEFIELD UIC }{ MERGEFIELD
ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

NB, you cannot eeliminate the final paragraph mark on a page, but a
directory merge does not insert that one in the output anyway, i.e. if your
mail merge main document just ha

{ MERGEFIELD UIC }

and nothing else except that final para, your output would have

UIC1UIC2UIC3UIC4...

You may find in practice that this introduces other problems (for one thing,
I hope I have the logic the right way around!) but try it anyway.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
...
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.




  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Help with embedded "If"

I was away for a couple of days - if you still need a solution I'll have
another look.

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

"Suzanne" wrote in message
...
After a full day of hopefully waiting for someone to tell me that there is
some method of doing what I need, I'll close this out and get on to
cutting/pasting the data for each record (sigh).

Thanks Peter for your help... Suz

"Suzanne" wrote:

I can't get this working... I've been able to get new record breaks
after
each UIC, but have yet to see just the list of names on the second page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of text)
Second Page: All people with the same UIC and Room (everyone in the room
will have the same building number but not necessarily the same UIC)

I can adjust the first page of the form so that one table cell will
contain
UIC, BLDG, ROOM. On the top of the second page, I need a list of names
for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to manually
Alt-Tab
between two document to cut/paste the information on the forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a question of
"where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably needs to
have
a page break at the end - you can insert one in the result text) and
perhaps
you will also need to repeat some of the fields at the beginning of
that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

At the moment, my suggestion assumes that the stuff you have in
"whatever
you want here" will be output for every record. This is because in this
kind
of merge, the first record in the group also usually contains the data
for
the first detail record in the group IYSWIM. What I am not sure about
in
this case is what you mean by...

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

Can you provide an example of the kind of layout you need to achieve?
If you
need to avoid having paragraph marks between each record, you need to
eliminate any paragraph marks in the mail merge main document that
would be
output following any of the records, and that probably also means that
you
need to insert a page break at the beginning of the "heading texts",
e.g.

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }

{ MERGEFIELD ROOM } } } = 2
"page break{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

If you need to eliminate the page break on page 1, try

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ IF { LUIC } "" "page break" "" }{ MERGEFIELD UIC }{ MERGEFIELD
ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

NB, you cannot eeliminate the final paragraph mark on a page, but a
directory merge does not insert that one in the output anyway, i.e. if
your
mail merge main document just ha

{ MERGEFIELD UIC }

and nothing else except that final para, your output would have

UIC1UIC2UIC3UIC4...

You may find in practice that this introduces other problems (for one
thing,
I hope I have the logic the right way around!) but try it anyway.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
...
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.





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

Peter,

You're a lifesaver. Look for my post "I almost have the 2-page merge" in
this thread.

When/if you open my Word doc (it's on my Office Live site:
http://suzleigh.com/MERGE.aspx), it will look a little mangled. Regardless,
I really think that I may almost have this nailed down.

I was able to get this far by creating a new column in my Excel worksheet:
"UICROOM" -- UIC & ROOM (this might be helpful for anyone in the future who
is having the same problem). On plain paper, I get exactly the results I'm
looking for. I still can't get the results on the actual form.

If you look at the form, you'll also see that I switched the pages to avoid
having to sift through rows/columns of data to get to the names listing (the
name listing is now page 1; the detailed form is page 2).

Would love your help (and/or anyone else who might be listening in).

Suz

"Peter Jamieson" wrote:

I was away for a couple of days - if you still need a solution I'll have
another look.

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

"Suzanne" wrote in message
...
After a full day of hopefully waiting for someone to tell me that there is
some method of doing what I need, I'll close this out and get on to
cutting/pasting the data for each record (sigh).

Thanks Peter for your help... Suz

"Suzanne" wrote:

I can't get this working... I've been able to get new record breaks
after
each UIC, but have yet to see just the list of names on the second page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of text)
Second Page: All people with the same UIC and Room (everyone in the room
will have the same building number but not necessarily the same UIC)

I can adjust the first page of the form so that one table cell will
contain
UIC, BLDG, ROOM. On the top of the second page, I need a list of names
for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to manually
Alt-Tab
between two document to cut/paste the information on the forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a question of
"where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably needs to
have
a page break at the end - you can insert one in the result text) and
perhaps
you will also need to repeat some of the fields at the beginning of
that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

At the moment, my suggestion assumes that the stuff you have in
"whatever
you want here" will be output for every record. This is because in this
kind
of merge, the first record in the group also usually contains the data
for
the first detail record in the group IYSWIM. What I am not sure about
in
this case is what you mean by...

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

Can you provide an example of the kind of layout you need to achieve?
If you
need to avoid having paragraph marks between each record, you need to
eliminate any paragraph marks in the mail merge main document that
would be
output following any of the records, and that probably also means that
you
need to insert a page break at the beginning of the "heading texts",
e.g.

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }

{ MERGEFIELD ROOM } } } = 2
"page break{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

If you need to eliminate the page break on page 1, try

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE { LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ IF { LUIC } "" "page break" "" }{ MERGEFIELD UIC }{ MERGEFIELD
ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

NB, you cannot eeliminate the final paragraph mark on a page, but a
directory merge does not insert that one in the output anyway, i.e. if
your
mail merge main document just ha

{ MERGEFIELD UIC }

and nothing else except that final para, your output would have

UIC1UIC2UIC3UIC4...

You may find in practice that this introduces other problems (for one
thing,
I hope I have the logic the right way around!) but try it anyway.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
...
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.






  #9   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Help with embedded "If"

1. I think it's a bit easier to follow the logic if you stick to using one
local variable (and the pattern I suggested before, where you explicitly set
LOC to "" in that first record, then test LOC against the value of
MERGEFIELD UICROOM, and set LOC again at the end of the mail merge main
document.

2. Because of the way this technique works, it's easiest to imagine that the
list of names always comes last. Because you actually want some notes etc.
after the list of names, when you use this technique, you then have to put
those notes at the very beginning and eliminate them when MERGESEQ is 1 1.
So your merge then looks something like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }{ SET NOTES "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"{ NOTES }
your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{ SET LOC { MERGEFIELD
UICROOM }{ SET NOTES "whatever you want in the notes at the end of this
group of recordspage or section break }

3. The trouble with this is that the notes under your last list of names
will never be emitted. But because of the way Word works, I don't think you
can logically achieve what you need without also ensuring that you know
which the last record in each group is. If you know that, e.g. because you
mark the last recors in each group, you can do something more like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{
{ IF { MERGEFIELD LASTRECORDINGROUP } = "Y" "output your note text here"
"" }{ SET LOC { MERGEFIELD UICROOM }

Sorry, it's now rather late here so I may not be thinking straight, but
Ireally think that's what you need to do.

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

"Suzanne" wrote in message
...
Peter,

You're a lifesaver. Look for my post "I almost have the 2-page merge" in
this thread.

When/if you open my Word doc (it's on my Office Live site:
http://suzleigh.com/MERGE.aspx), it will look a little mangled.
Regardless,
I really think that I may almost have this nailed down.

I was able to get this far by creating a new column in my Excel worksheet:
"UICROOM" -- UIC & ROOM (this might be helpful for anyone in the future
who
is having the same problem). On plain paper, I get exactly the results
I'm
looking for. I still can't get the results on the actual form.

If you look at the form, you'll also see that I switched the pages to
avoid
having to sift through rows/columns of data to get to the names listing
(the
name listing is now page 1; the detailed form is page 2).

Would love your help (and/or anyone else who might be listening in).

Suz

"Peter Jamieson" wrote:

I was away for a couple of days - if you still need a solution I'll have
another look.

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

"Suzanne" wrote in message
...
After a full day of hopefully waiting for someone to tell me that there
is
some method of doing what I need, I'll close this out and get on to
cutting/pasting the data for each record (sigh).

Thanks Peter for your help... Suz

"Suzanne" wrote:

I can't get this working... I've been able to get new record breaks
after
each UIC, but have yet to see just the list of names on the second
page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of text)
Second Page: All people with the same UIC and Room (everyone in the
room
will have the same building number but not necessarily the same UIC)

I can adjust the first page of the form so that one table cell will
contain
UIC, BLDG, ROOM. On the top of the second page, I need a list of
names
for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to manually
Alt-Tab
between two document to cut/paste the information on the forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a question of
"where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably needs
to
have
a page break at the end - you can insert one in the result text) and
perhaps
you will also need to repeat some of the fields at the beginning of
that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

At the moment, my suggestion assumes that the stuff you have in
"whatever
you want here" will be output for every record. This is because in
this
kind
of merge, the first record in the group also usually contains the
data
for
the first detail record in the group IYSWIM. What I am not sure
about
in
this case is what you mean by...

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

Can you provide an example of the kind of layout you need to
achieve?
If you
need to avoid having paragraph marks between each record, you need
to
eliminate any paragraph marks in the mail merge main document that
would be
output following any of the records, and that probably also means
that
you
need to insert a page break at the beginning of the "heading texts",
e.g.

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"page break{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

If you need to eliminate the page break on page 1, try

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ IF { LUIC } "" "page break" "" }{ MERGEFIELD UIC }{
MERGEFIELD
ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

NB, you cannot eeliminate the final paragraph mark on a page, but a
directory merge does not insert that one in the output anyway, i.e.
if
your
mail merge main document just ha

{ MERGEFIELD UIC }

and nothing else except that final para, your output would have

UIC1UIC2UIC3UIC4...

You may find in practice that this introduces other problems (for
one
thing,
I hope I have the logic the right way around!) but try it anyway.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
...
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.







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

I tried your last example. It's not working.

The result had the first two names at the top and did not pull everyone
together.

I've been messing with it; at one point I had the names grouped, but
somewhere along the line I messed that up. I'm getting a variety of results
as I continue to mess with this (error codes, misplaced data, skipped
records).

At this point I'm not even working with the actual form but rather a plain
page test document. I think if I can get the plain page worked out, I can
apply it to the real thing.

Thanks -- Suzanne

I still think the answer is close.

"Peter Jamieson" wrote:

1. I think it's a bit easier to follow the logic if you stick to using one
local variable (and the pattern I suggested before, where you explicitly set
LOC to "" in that first record, then test LOC against the value of
MERGEFIELD UICROOM, and set LOC again at the end of the mail merge main
document.

2. Because of the way this technique works, it's easiest to imagine that the
list of names always comes last. Because you actually want some notes etc.
after the list of names, when you use this technique, you then have to put
those notes at the very beginning and eliminate them when MERGESEQ is 1 1.
So your merge then looks something like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }{ SET NOTES "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"{ NOTES }
your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{ SET LOC { MERGEFIELD
UICROOM }{ SET NOTES "whatever you want in the notes at the end of this
group of recordspage or section break }

3. The trouble with this is that the notes under your last list of names
will never be emitted. But because of the way Word works, I don't think you
can logically achieve what you need without also ensuring that you know
which the last record in each group is. If you know that, e.g. because you
mark the last recors in each group, you can do something more like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{
{ IF { MERGEFIELD LASTRECORDINGROUP } = "Y" "output your note text here"
"" }{ SET LOC { MERGEFIELD UICROOM }

Sorry, it's now rather late here so I may not be thinking straight, but
Ireally think that's what you need to do.

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

"Suzanne" wrote in message
...
Peter,

You're a lifesaver. Look for my post "I almost have the 2-page merge" in
this thread.

When/if you open my Word doc (it's on my Office Live site:
http://suzleigh.com/MERGE.aspx), it will look a little mangled.
Regardless,
I really think that I may almost have this nailed down.

I was able to get this far by creating a new column in my Excel worksheet:
"UICROOM" -- UIC & ROOM (this might be helpful for anyone in the future
who
is having the same problem). On plain paper, I get exactly the results
I'm
looking for. I still can't get the results on the actual form.

If you look at the form, you'll also see that I switched the pages to
avoid
having to sift through rows/columns of data to get to the names listing
(the
name listing is now page 1; the detailed form is page 2).

Would love your help (and/or anyone else who might be listening in).

Suz

"Peter Jamieson" wrote:

I was away for a couple of days - if you still need a solution I'll have
another look.

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

"Suzanne" wrote in message
...
After a full day of hopefully waiting for someone to tell me that there
is
some method of doing what I need, I'll close this out and get on to
cutting/pasting the data for each record (sigh).

Thanks Peter for your help... Suz

"Suzanne" wrote:

I can't get this working... I've been able to get new record breaks
after
each UIC, but have yet to see just the list of names on the second
page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of text)
Second Page: All people with the same UIC and Room (everyone in the
room
will have the same building number but not necessarily the same UIC)

I can adjust the first page of the form so that one table cell will
contain
UIC, BLDG, ROOM. On the top of the second page, I need a list of
names
for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to manually
Alt-Tab
between two document to cut/paste the information on the forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a question of
"where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably needs
to
have
a page break at the end - you can insert one in the result text) and
perhaps
you will also need to repeat some of the fields at the beginning of
that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

At the moment, my suggestion assumes that the stuff you have in
"whatever
you want here" will be output for every record. This is because in
this
kind
of merge, the first record in the group also usually contains the
data
for
the first detail record in the group IYSWIM. What I am not sure
about
in
this case is what you mean by...

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

Can you provide an example of the kind of layout you need to
achieve?
If you
need to avoid having paragraph marks between each record, you need
to
eliminate any paragraph marks in the mail merge main document that
would be
output following any of the records, and that probably also means
that
you
need to insert a page break at the beginning of the "heading texts",
e.g.

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"page break{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

If you need to eliminate the page break on page 1, try

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ IF { LUIC } "" "page break" "" }{ MERGEFIELD UIC }{
MERGEFIELD
ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page 2
" "" }

NB, you cannot eeliminate the final paragraph mark on a page, but a
directory merge does not insert that one in the output anyway, i.e.
if
your
mail merge main document just ha

{ MERGEFIELD UIC }

and nothing else except that final para, your output would have

UIC1UIC2UIC3UIC4...

You may find in practice that this introduces other problems (for
one
thing,
I hope I have the logic the right way around!) but try it anyway.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
...
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 }



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

I tried your last example. It's not working.

The result had the first two names at the top and did not pull everyone
together.

I've been messing with it; at one point I had the names grouped, but
somewhere along the line I messed that up. I'm getting a variety of results
as I continue to mess with this (error codes, misplaced data, skipped
records).

At this point I'm not even working with the actual form but rather a plain
page test document. I think if I can get the plain page worked out, I can
apply it to the real thing.

Thanks -- Suzanne

(I still think the answer is close)
  #12   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Help with embedded "If"

Can you try opening the following URL in your browser, right-clicking on the
link and downloading the .doc in there?

http://tips.pjmsn.me.uk/suzanne

This .doc should demonstrate the /first/ solution I suggested (although the
layout probably needs fixing in various ways). If not, can you please
describe what it does not do, apart from the known problem of dealing with
the notes in the last record.

If you would find it easier to correspond by e-mail, please despam my e-mail
(remove KillmapS) and email me.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
news
I tried your last example. It's not working.

The result had the first two names at the top and did not pull everyone
together.

I've been messing with it; at one point I had the names grouped, but
somewhere along the line I messed that up. I'm getting a variety of
results
as I continue to mess with this (error codes, misplaced data, skipped
records).

At this point I'm not even working with the actual form but rather a plain
page test document. I think if I can get the plain page worked out, I can
apply it to the real thing.

Thanks -- Suzanne

I still think the answer is close.

"Peter Jamieson" wrote:

1. I think it's a bit easier to follow the logic if you stick to using
one
local variable (and the pattern I suggested before, where you explicitly
set
LOC to "" in that first record, then test LOC against the value of
MERGEFIELD UICROOM, and set LOC again at the end of the mail merge main
document.

2. Because of the way this technique works, it's easiest to imagine that
the
list of names always comes last. Because you actually want some notes
etc.
after the list of names, when you use this technique, you then have to
put
those notes at the very beginning and eliminate them when MERGESEQ is 1
1.
So your merge then looks something like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }{ SET NOTES "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"{ NOTES }
your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{ SET LOC { MERGEFIELD
UICROOM }{ SET NOTES "whatever you want in the notes at the end of this
group of recordspage or section break }

3. The trouble with this is that the notes under your last list of names
will never be emitted. But because of the way Word works, I don't think
you
can logically achieve what you need without also ensuring that you know
which the last record in each group is. If you know that, e.g. because
you
mark the last recors in each group, you can do something more like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{
{ IF { MERGEFIELD LASTRECORDINGROUP } = "Y" "output your note text here"
"" }{ SET LOC { MERGEFIELD UICROOM }

Sorry, it's now rather late here so I may not be thinking straight, but
Ireally think that's what you need to do.

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

"Suzanne" wrote in message
...
Peter,

You're a lifesaver. Look for my post "I almost have the 2-page merge"
in
this thread.

When/if you open my Word doc (it's on my Office Live site:
http://suzleigh.com/MERGE.aspx), it will look a little mangled.
Regardless,
I really think that I may almost have this nailed down.

I was able to get this far by creating a new column in my Excel
worksheet:
"UICROOM" -- UIC & ROOM (this might be helpful for anyone in the future
who
is having the same problem). On plain paper, I get exactly the results
I'm
looking for. I still can't get the results on the actual form.

If you look at the form, you'll also see that I switched the pages to
avoid
having to sift through rows/columns of data to get to the names listing
(the
name listing is now page 1; the detailed form is page 2).

Would love your help (and/or anyone else who might be listening in).

Suz

"Peter Jamieson" wrote:

I was away for a couple of days - if you still need a solution I'll
have
another look.

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

"Suzanne" wrote in message
...
After a full day of hopefully waiting for someone to tell me that
there
is
some method of doing what I need, I'll close this out and get on to
cutting/pasting the data for each record (sigh).

Thanks Peter for your help... Suz

"Suzanne" wrote:

I can't get this working... I've been able to get new record
breaks
after
each UIC, but have yet to see just the list of names on the second
page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of text)
Second Page: All people with the same UIC and Room (everyone in
the
room
will have the same building number but not necessarily the same
UIC)

I can adjust the first page of the form so that one table cell will
contain
UIC, BLDG, ROOM. On the top of the second page, I need a list of
names
for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to
manually
Alt-Tab
between two document to cut/paste the information on the forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a question of
"where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably
needs
to
have
a page break at the end - you can insert one in the result text)
and
perhaps
you will also need to repeat some of the fields at the beginning
of
that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page
2
" "" }

At the moment, my suggestion assumes that the stuff you have in
"whatever
you want here" will be output for every record. This is because
in
this
kind
of merge, the first record in the group also usually contains the
data
for
the first detail record in the group IYSWIM. What I am not sure
about
in
this case is what you mean by...

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

Can you provide an example of the kind of layout you need to
achieve?
If you
need to avoid having paragraph marks between each record, you
need
to
eliminate any paragraph marks in the mail merge main document
that
would be
output following any of the records, and that probably also means
that
you
need to insert a page break at the beginning of the "heading
texts",
e.g.

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"page break{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page
2
" "" }

If you need to eliminate the page break on page 1, try

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ IF { LUIC } "" "page break" "" }{ MERGEFIELD UIC }{
MERGEFIELD
ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page
2
" "" }

NB, you cannot eeliminate the final paragraph mark on a page, but
a
directory merge does not insert that one in the output anyway,
i.e.
if
your
mail merge main document just ha

{ MERGEFIELD UIC }

and nothing else except that final para, your output would have

UIC1UIC2UIC3UIC4...

You may find in practice that this introduces other problems (for
one
thing,
I hope I have the logic the right way around!) but try it anyway.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
...
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 }


  #13   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Help with embedded "If"

BTW, you may need to select the mail merge main document using e.g.
control-A and press F9 to re-execute all the fields

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

"Peter Jamieson" wrote in message
...
Can you try opening the following URL in your browser, right-clicking on
the link and downloading the .doc in there?

http://tips.pjmsn.me.uk/suzanne

This .doc should demonstrate the /first/ solution I suggested (although
the layout probably needs fixing in various ways). If not, can you please
describe what it does not do, apart from the known problem of dealing with
the notes in the last record.

If you would find it easier to correspond by e-mail, please despam my
e-mail (remove KillmapS) and email me.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
news
I tried your last example. It's not working.

The result had the first two names at the top and did not pull everyone
together.

I've been messing with it; at one point I had the names grouped, but
somewhere along the line I messed that up. I'm getting a variety of
results
as I continue to mess with this (error codes, misplaced data, skipped
records).

At this point I'm not even working with the actual form but rather a
plain
page test document. I think if I can get the plain page worked out, I
can
apply it to the real thing.

Thanks -- Suzanne

I still think the answer is close.

"Peter Jamieson" wrote:

1. I think it's a bit easier to follow the logic if you stick to using
one
local variable (and the pattern I suggested before, where you explicitly
set
LOC to "" in that first record, then test LOC against the value of
MERGEFIELD UICROOM, and set LOC again at the end of the mail merge main
document.

2. Because of the way this technique works, it's easiest to imagine that
the
list of names always comes last. Because you actually want some notes
etc.
after the list of names, when you use this technique, you then have to
put
those notes at the very beginning and eliminate them when MERGESEQ is 1
1.
So your merge then looks something like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }{ SET NOTES "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"{ NOTES }
your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{ SET LOC { MERGEFIELD
UICROOM }{ SET NOTES "whatever you want in the notes at the end of this
group of recordspage or section break }

3. The trouble with this is that the notes under your last list of names
will never be emitted. But because of the way Word works, I don't think
you
can logically achieve what you need without also ensuring that you know
which the last record in each group is. If you know that, e.g. because
you
mark the last recors in each group, you can do something more like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{
{ IF { MERGEFIELD LASTRECORDINGROUP } = "Y" "output your note text here"
"" }{ SET LOC { MERGEFIELD UICROOM }

Sorry, it's now rather late here so I may not be thinking straight, but
Ireally think that's what you need to do.

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

"Suzanne" wrote in message
...
Peter,

You're a lifesaver. Look for my post "I almost have the 2-page merge"
in
this thread.

When/if you open my Word doc (it's on my Office Live site:
http://suzleigh.com/MERGE.aspx), it will look a little mangled.
Regardless,
I really think that I may almost have this nailed down.

I was able to get this far by creating a new column in my Excel
worksheet:
"UICROOM" -- UIC & ROOM (this might be helpful for anyone in the
future
who
is having the same problem). On plain paper, I get exactly the
results
I'm
looking for. I still can't get the results on the actual form.

If you look at the form, you'll also see that I switched the pages to
avoid
having to sift through rows/columns of data to get to the names
listing
(the
name listing is now page 1; the detailed form is page 2).

Would love your help (and/or anyone else who might be listening in).

Suz

"Peter Jamieson" wrote:

I was away for a couple of days - if you still need a solution I'll
have
another look.

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

"Suzanne" wrote in message
...
After a full day of hopefully waiting for someone to tell me that
there
is
some method of doing what I need, I'll close this out and get on to
cutting/pasting the data for each record (sigh).

Thanks Peter for your help... Suz

"Suzanne" wrote:

I can't get this working... I've been able to get new record
breaks
after
each UIC, but have yet to see just the list of names on the second
page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of text)
Second Page: All people with the same UIC and Room (everyone in
the
room
will have the same building number but not necessarily the same
UIC)

I can adjust the first page of the form so that one table cell
will
contain
UIC, BLDG, ROOM. On the top of the second page, I need a list of
names
for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to
manually
Alt-Tab
between two document to cut/paste the information on the forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a question
of
"where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably
needs
to
have
a page break at the end - you can insert one in the result text)
and
perhaps
you will also need to repeat some of the fields at the beginning
of
that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page
2
" "" }

At the moment, my suggestion assumes that the stuff you have in
"whatever
you want here" will be output for every record. This is because
in
this
kind
of merge, the first record in the group also usually contains
the
data
for
the first detail record in the group IYSWIM. What I am not sure
about
in
this case is what you mean by...

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

Can you provide an example of the kind of layout you need to
achieve?
If you
need to avoid having paragraph marks between each record, you
need
to
eliminate any paragraph marks in the mail merge main document
that
would be
output following any of the records, and that probably also
means
that
you
need to insert a page break at the beginning of the "heading
texts",
e.g.

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"page break{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page
2
" "" }

If you need to eliminate the page break on page 1, try

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ IF { LUIC } "" "page break" "" }{ MERGEFIELD UIC }{
MERGEFIELD
ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page
2
" "" }

NB, you cannot eeliminate the final paragraph mark on a page,
but a
directory merge does not insert that one in the output anyway,
i.e.
if
your
mail merge main document just ha

{ MERGEFIELD UIC }

and nothing else except that final para, your output would have

UIC1UIC2UIC3UIC4...

You may find in practice that this introduces other problems
(for
one
thing,
I hope I have the logic the right way around!) but try it
anyway.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
...
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 }



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

YOU ARE AWESOME!!!!!!! I KNEW this could be done!! Thank you for not
giving up on this or telling me that what I needed to do was not possible!

The form works PERFECTLY. I've already entered the rest of my fields with
absolutely no problem and even restructured the first so that the UIC, BLDG,
etc. is within the table.

This will absolutely be a 'read-only' document forever and ever (I do NOT
want to go through this again -- although, I now know more about merge codes
than I used to!).

THANK YOU THANK YOU THANK YOU!!!

Suzanne

"Peter Jamieson" wrote:

BTW, you may need to select the mail merge main document using e.g.
control-A and press F9 to re-execute all the fields

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

"Peter Jamieson" wrote in message
...
Can you try opening the following URL in your browser, right-clicking on
the link and downloading the .doc in there?

http://tips.pjmsn.me.uk/suzanne

This .doc should demonstrate the /first/ solution I suggested (although
the layout probably needs fixing in various ways). If not, can you please
describe what it does not do, apart from the known problem of dealing with
the notes in the last record.

If you would find it easier to correspond by e-mail, please despam my
e-mail (remove KillmapS) and email me.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
news
I tried your last example. It's not working.

The result had the first two names at the top and did not pull everyone
together.

I've been messing with it; at one point I had the names grouped, but
somewhere along the line I messed that up. I'm getting a variety of
results
as I continue to mess with this (error codes, misplaced data, skipped
records).

At this point I'm not even working with the actual form but rather a
plain
page test document. I think if I can get the plain page worked out, I
can
apply it to the real thing.

Thanks -- Suzanne

I still think the answer is close.

"Peter Jamieson" wrote:

1. I think it's a bit easier to follow the logic if you stick to using
one
local variable (and the pattern I suggested before, where you explicitly
set
LOC to "" in that first record, then test LOC against the value of
MERGEFIELD UICROOM, and set LOC again at the end of the mail merge main
document.

2. Because of the way this technique works, it's easiest to imagine that
the
list of names always comes last. Because you actually want some notes
etc.
after the list of names, when you use this technique, you then have to
put
those notes at the very beginning and eliminate them when MERGESEQ is 1
1.
So your merge then looks something like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }{ SET NOTES "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"{ NOTES }
your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{ SET LOC { MERGEFIELD
UICROOM }{ SET NOTES "whatever you want in the notes at the end of this
group of recordspage or section break }

3. The trouble with this is that the notes under your last list of names
will never be emitted. But because of the way Word works, I don't think
you
can logically achieve what you need without also ensuring that you know
which the last record in each group is. If you know that, e.g. because
you
mark the last recors in each group, you can do something more like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{
{ IF { MERGEFIELD LASTRECORDINGROUP } = "Y" "output your note text here"
"" }{ SET LOC { MERGEFIELD UICROOM }

Sorry, it's now rather late here so I may not be thinking straight, but
Ireally think that's what you need to do.

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

"Suzanne" wrote in message
...
Peter,

You're a lifesaver. Look for my post "I almost have the 2-page merge"
in
this thread.

When/if you open my Word doc (it's on my Office Live site:
http://suzleigh.com/MERGE.aspx), it will look a little mangled.
Regardless,
I really think that I may almost have this nailed down.

I was able to get this far by creating a new column in my Excel
worksheet:
"UICROOM" -- UIC & ROOM (this might be helpful for anyone in the
future
who
is having the same problem). On plain paper, I get exactly the
results
I'm
looking for. I still can't get the results on the actual form.

If you look at the form, you'll also see that I switched the pages to
avoid
having to sift through rows/columns of data to get to the names
listing
(the
name listing is now page 1; the detailed form is page 2).

Would love your help (and/or anyone else who might be listening in).

Suz

"Peter Jamieson" wrote:

I was away for a couple of days - if you still need a solution I'll
have
another look.

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

"Suzanne" wrote in message
...
After a full day of hopefully waiting for someone to tell me that
there
is
some method of doing what I need, I'll close this out and get on to
cutting/pasting the data for each record (sigh).

Thanks Peter for your help... Suz

"Suzanne" wrote:

I can't get this working... I've been able to get new record
breaks
after
each UIC, but have yet to see just the list of names on the second
page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of text)
Second Page: All people with the same UIC and Room (everyone in
the
room
will have the same building number but not necessarily the same
UIC)

I can adjust the first page of the form so that one table cell
will
contain
UIC, BLDG, ROOM. On the top of the second page, I need a list of
names
for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to
manually
Alt-Tab
between two document to cut/paste the information on the forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a question
of
"where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably
needs
to
have
a page break at the end - you can insert one in the result text)
and
perhaps
you will also need to repeat some of the fields at the beginning
of
that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page
2
" "" }

At the moment, my suggestion assumes that the stuff you have in
"whatever
you want here" will be output for every record. This is because
in
this
kind
of merge, the first record in the group also usually contains
the
data
for
the first detail record in the group IYSWIM. What I am not sure
about
in
this case is what you mean by...

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

Can you provide an example of the kind of layout you need to
achieve?
If you
need to avoid having paragraph marks between each record, you
need
to
eliminate any paragraph marks in the mail merge main document
that
would be
output following any of the records, and that probably also
means
that
you
need to insert a page break at the beginning of the "heading
texts",
e.g.

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"page break{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page
2
" "" }

If you need to eliminate the page break on page 1, try

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE {
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ IF { LUIC } "" "page break" "" }{ MERGEFIELD UIC }{
MERGEFIELD
ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of page
2
" "" }

NB, you cannot eeliminate the final paragraph mark on a page,
but a
directory merge does not insert that one in the output anyway,
i.e.

  #15   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Help with embedded "If"

Hi Suzanne

(Phew!)

If you haven't checked the very last page of output from this merge, please
do so. If it's OK, we can all relax. Otherwise, maybe that approach I
mentioned - where the last record in each group needs to be marked - needs
to be used. Or maybe it would be enough to add that chunk manually.

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

"Suzanne" wrote in message
...
YOU ARE AWESOME!!!!!!! I KNEW this could be done!! Thank you for not
giving up on this or telling me that what I needed to do was not possible!

The form works PERFECTLY. I've already entered the rest of my fields with
absolutely no problem and even restructured the first so that the UIC,
BLDG,
etc. is within the table.

This will absolutely be a 'read-only' document forever and ever (I do NOT
want to go through this again -- although, I now know more about merge
codes
than I used to!).

THANK YOU THANK YOU THANK YOU!!!

Suzanne

"Peter Jamieson" wrote:

BTW, you may need to select the mail merge main document using e.g.
control-A and press F9 to re-execute all the fields

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

"Peter Jamieson" wrote in message
...
Can you try opening the following URL in your browser, right-clicking
on
the link and downloading the .doc in there?

http://tips.pjmsn.me.uk/suzanne

This .doc should demonstrate the /first/ solution I suggested (although
the layout probably needs fixing in various ways). If not, can you
please
describe what it does not do, apart from the known problem of dealing
with
the notes in the last record.

If you would find it easier to correspond by e-mail, please despam my
e-mail (remove KillmapS) and email me.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
news I tried your last example. It's not working.

The result had the first two names at the top and did not pull
everyone
together.

I've been messing with it; at one point I had the names grouped, but
somewhere along the line I messed that up. I'm getting a variety of
results
as I continue to mess with this (error codes, misplaced data, skipped
records).

At this point I'm not even working with the actual form but rather a
plain
page test document. I think if I can get the plain page worked out, I
can
apply it to the real thing.

Thanks -- Suzanne

I still think the answer is close.

"Peter Jamieson" wrote:

1. I think it's a bit easier to follow the logic if you stick to
using
one
local variable (and the pattern I suggested before, where you
explicitly
set
LOC to "" in that first record, then test LOC against the value of
MERGEFIELD UICROOM, and set LOC again at the end of the mail merge
main
document.

2. Because of the way this technique works, it's easiest to imagine
that
the
list of names always comes last. Because you actually want some notes
etc.
after the list of names, when you use this technique, you then have
to
put
those notes at the very beginning and eliminate them when MERGESEQ
is 1
1.
So your merge then looks something like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }{ SET NOTES "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"{ NOTES }
your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{ SET LOC { MERGEFIELD
UICROOM }{ SET NOTES "whatever you want in the notes at the end of
this
group of recordspage or section break }

3. The trouble with this is that the notes under your last list of
names
will never be emitted. But because of the way Word works, I don't
think
you
can logically achieve what you need without also ensuring that you
know
which the last record in each group is. If you know that, e.g.
because
you
mark the last recors in each group, you can do something more like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{
{ IF { MERGEFIELD LASTRECORDINGROUP } = "Y" "output your note text
here"
"" }{ SET LOC { MERGEFIELD UICROOM }

Sorry, it's now rather late here so I may not be thinking straight,
but
Ireally think that's what you need to do.

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

"Suzanne" wrote in message
...
Peter,

You're a lifesaver. Look for my post "I almost have the 2-page
merge"
in
this thread.

When/if you open my Word doc (it's on my Office Live site:
http://suzleigh.com/MERGE.aspx), it will look a little mangled.
Regardless,
I really think that I may almost have this nailed down.

I was able to get this far by creating a new column in my Excel
worksheet:
"UICROOM" -- UIC & ROOM (this might be helpful for anyone in the
future
who
is having the same problem). On plain paper, I get exactly the
results
I'm
looking for. I still can't get the results on the actual form.

If you look at the form, you'll also see that I switched the pages
to
avoid
having to sift through rows/columns of data to get to the names
listing
(the
name listing is now page 1; the detailed form is page 2).

Would love your help (and/or anyone else who might be listening
in).

Suz

"Peter Jamieson" wrote:

I was away for a couple of days - if you still need a solution
I'll
have
another look.

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

"Suzanne" wrote in message
...
After a full day of hopefully waiting for someone to tell me
that
there
is
some method of doing what I need, I'll close this out and get on
to
cutting/pasting the data for each record (sigh).

Thanks Peter for your help... Suz

"Suzanne" wrote:

I can't get this working... I've been able to get new record
breaks
after
each UIC, but have yet to see just the list of names on the
second
page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of text)
Second Page: All people with the same UIC and Room (everyone
in
the
room
will have the same building number but not necessarily the same
UIC)

I can adjust the first page of the form so that one table cell
will
contain
UIC, BLDG, ROOM. On the top of the second page, I need a list
of
names
for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to
manually
Alt-Tab
between two document to cut/paste the information on the forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a
question
of
"where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE
{
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably
needs
to
have
a page break at the end - you can insert one in the result
text)
and
perhaps
you will also need to repeat some of the fields at the
beginning
of
that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE
{
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of
page
2
" "" }

At the moment, my suggestion assumes that the stuff you have
in
"whatever
you want here" will be output for every record. This is
because
in
this
kind
of merge, the first record in the group also usually contains
the
data
for
the first detail record in the group IYSWIM. What I am not
sure
about
in
this case is what you mean by...

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

Can you provide an example of the kind of layout you need to
achieve?
If you
need to avoid having paragraph marks between each record, you
need
to
eliminate any paragraph marks in the mail merge main document
that
would be
output following any of the records, and that probably also
means
that
you
need to insert a page break at the beginning of the "heading
texts",
e.g.

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE
{
LROOM }

{ MERGEFIELD ROOM } } } = 2
"page break{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of
page
2
" "" }

If you need to eliminate the page break on page 1, try

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE
{
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ IF { LUIC } "" "page break" "" }{ MERGEFIELD UIC }{
MERGEFIELD
ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of
page
2
" "" }

NB, you cannot eeliminate the final paragraph mark on a page,
but a
directory merge does not insert that one in the output
anyway,
i.e.




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

Yes... the last page didn't have the notes, but this is an easy cut/past (I
might also try putting a dummy record at the end of the worksheet). MUCH
MUCH easier to think about than having to cut/paste each section of people
into their respective rooms.

I just ran a report with nearly 200 people in different buildings, rooms,
UICs -- front and back report was 70 pages. That's 70 pages I didn't have to
spend wearing out Alt-Tab keys!

Now that the worst is over, there's a couple of things I'll be trying out,
but won't be as frustrated with if I don't get it. You may have noticed the
"No. CIV" "No. MIL" etc. fields at the bottom of section 2... I'm trying out
some methods to count the number of "DAC" "AD-A" "AD-AF" in section 2 and
plunk the number into the appropriate field in section 1.

Again, you are AWESOME!! Have a GREAT weekend!!!

Suzanne

"Peter Jamieson" wrote:

Hi Suzanne

(Phew!)

If you haven't checked the very last page of output from this merge, please
do so. If it's OK, we can all relax. Otherwise, maybe that approach I
mentioned - where the last record in each group needs to be marked - needs
to be used. Or maybe it would be enough to add that chunk manually.

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

"Suzanne" wrote in message
...
YOU ARE AWESOME!!!!!!! I KNEW this could be done!! Thank you for not
giving up on this or telling me that what I needed to do was not possible!

The form works PERFECTLY. I've already entered the rest of my fields with
absolutely no problem and even restructured the first so that the UIC,
BLDG,
etc. is within the table.

This will absolutely be a 'read-only' document forever and ever (I do NOT
want to go through this again -- although, I now know more about merge
codes
than I used to!).

THANK YOU THANK YOU THANK YOU!!!

Suzanne

"Peter Jamieson" wrote:

BTW, you may need to select the mail merge main document using e.g.
control-A and press F9 to re-execute all the fields

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

"Peter Jamieson" wrote in message
...
Can you try opening the following URL in your browser, right-clicking
on
the link and downloading the .doc in there?

http://tips.pjmsn.me.uk/suzanne

This .doc should demonstrate the /first/ solution I suggested (although
the layout probably needs fixing in various ways). If not, can you
please
describe what it does not do, apart from the known problem of dealing
with
the notes in the last record.

If you would find it easier to correspond by e-mail, please despam my
e-mail (remove KillmapS) and email me.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
news I tried your last example. It's not working.

The result had the first two names at the top and did not pull
everyone
together.

I've been messing with it; at one point I had the names grouped, but
somewhere along the line I messed that up. I'm getting a variety of
results
as I continue to mess with this (error codes, misplaced data, skipped
records).

At this point I'm not even working with the actual form but rather a
plain
page test document. I think if I can get the plain page worked out, I
can
apply it to the real thing.

Thanks -- Suzanne

I still think the answer is close.

"Peter Jamieson" wrote:

1. I think it's a bit easier to follow the logic if you stick to
using
one
local variable (and the pattern I suggested before, where you
explicitly
set
LOC to "" in that first record, then test LOC against the value of
MERGEFIELD UICROOM, and set LOC again at the end of the mail merge
main
document.

2. Because of the way this technique works, it's easiest to imagine
that
the
list of names always comes last. Because you actually want some notes
etc.
after the list of names, when you use this technique, you then have
to
put
those notes at the very beginning and eliminate them when MERGESEQ
is 1
1.
So your merge then looks something like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }{ SET NOTES "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"{ NOTES }
your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{ SET LOC { MERGEFIELD
UICROOM }{ SET NOTES "whatever you want in the notes at the end of
this
group of recordspage or section break }

3. The trouble with this is that the notes under your last list of
names
will never be emitted. But because of the way Word works, I don't
think
you
can logically achieve what you need without also ensuring that you
know
which the last record in each group is. If you know that, e.g.
because
you
mark the last recors in each group, you can do something more like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{
{ IF { MERGEFIELD LASTRECORDINGROUP } = "Y" "output your note text
here"
"" }{ SET LOC { MERGEFIELD UICROOM }

Sorry, it's now rather late here so I may not be thinking straight,
but
Ireally think that's what you need to do.

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

"Suzanne" wrote in message
...
Peter,

You're a lifesaver. Look for my post "I almost have the 2-page
merge"
in
this thread.

When/if you open my Word doc (it's on my Office Live site:
http://suzleigh.com/MERGE.aspx), it will look a little mangled.
Regardless,
I really think that I may almost have this nailed down.

I was able to get this far by creating a new column in my Excel
worksheet:
"UICROOM" -- UIC & ROOM (this might be helpful for anyone in the
future
who
is having the same problem). On plain paper, I get exactly the
results
I'm
looking for. I still can't get the results on the actual form.

If you look at the form, you'll also see that I switched the pages
to
avoid
having to sift through rows/columns of data to get to the names
listing
(the
name listing is now page 1; the detailed form is page 2).

Would love your help (and/or anyone else who might be listening
in).

Suz

"Peter Jamieson" wrote:

I was away for a couple of days - if you still need a solution
I'll
have
another look.

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

"Suzanne" wrote in message
...
After a full day of hopefully waiting for someone to tell me
that
there
is
some method of doing what I need, I'll close this out and get on
to
cutting/pasting the data for each record (sigh).

Thanks Peter for your help... Suz

"Suzanne" wrote:

I can't get this working... I've been able to get new record
breaks
after
each UIC, but have yet to see just the list of names on the
second
page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of text)
Second Page: All people with the same UIC and Room (everyone
in
the
room
will have the same building number but not necessarily the same
UIC)

I can adjust the first page of the form so that one table cell
will
contain
UIC, BLDG, ROOM. On the top of the second page, I need a list
of
names
for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to
manually
Alt-Tab
between two document to cut/paste the information on the forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a
question
of
"where to
put your page break".

whatever you put in the TRUE result of the IF field here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE
{
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that probably
needs
to
have
a page break at the end - you can insert one in the result
text)
and
perhaps
you will also need to repeat some of the fields at the
beginning
of
that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{ COMPARE
{
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top of
page
2
" "" }

At the moment, my suggestion assumes that the stuff you have
in

  #17   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Help with embedded "If"

Hi Suzanne,

thanks for the feedback- as for the counts etc., my only suggeston is to try
to create the data source you need, including any "count" columns - it's
probably simpler than trying to add up stuff using field codes.

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

"Suzanne" wrote in message
...
Yes... the last page didn't have the notes, but this is an easy cut/past
(I
might also try putting a dummy record at the end of the worksheet). MUCH
MUCH easier to think about than having to cut/paste each section of people
into their respective rooms.

I just ran a report with nearly 200 people in different buildings, rooms,
UICs -- front and back report was 70 pages. That's 70 pages I didn't have
to
spend wearing out Alt-Tab keys!

Now that the worst is over, there's a couple of things I'll be trying out,
but won't be as frustrated with if I don't get it. You may have noticed
the
"No. CIV" "No. MIL" etc. fields at the bottom of section 2... I'm trying
out
some methods to count the number of "DAC" "AD-A" "AD-AF" in section 2 and
plunk the number into the appropriate field in section 1.

Again, you are AWESOME!! Have a GREAT weekend!!!

Suzanne

"Peter Jamieson" wrote:

Hi Suzanne

(Phew!)

If you haven't checked the very last page of output from this merge,
please
do so. If it's OK, we can all relax. Otherwise, maybe that approach I
mentioned - where the last record in each group needs to be marked -
needs
to be used. Or maybe it would be enough to add that chunk manually.

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

"Suzanne" wrote in message
...
YOU ARE AWESOME!!!!!!! I KNEW this could be done!! Thank you for not
giving up on this or telling me that what I needed to do was not
possible!

The form works PERFECTLY. I've already entered the rest of my fields
with
absolutely no problem and even restructured the first so that the UIC,
BLDG,
etc. is within the table.

This will absolutely be a 'read-only' document forever and ever (I do
NOT
want to go through this again -- although, I now know more about merge
codes
than I used to!).

THANK YOU THANK YOU THANK YOU!!!

Suzanne

"Peter Jamieson" wrote:

BTW, you may need to select the mail merge main document using e.g.
control-A and press F9 to re-execute all the fields

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

"Peter Jamieson" wrote in message
...
Can you try opening the following URL in your browser,
right-clicking
on
the link and downloading the .doc in there?

http://tips.pjmsn.me.uk/suzanne

This .doc should demonstrate the /first/ solution I suggested
(although
the layout probably needs fixing in various ways). If not, can you
please
describe what it does not do, apart from the known problem of
dealing
with
the notes in the last record.

If you would find it easier to correspond by e-mail, please despam
my
e-mail (remove KillmapS) and email me.
--
Peter Jamieson
http://tips.pjmsn.me.uk

"Suzanne" wrote in message
news I tried your last example. It's not working.

The result had the first two names at the top and did not pull
everyone
together.

I've been messing with it; at one point I had the names grouped,
but
somewhere along the line I messed that up. I'm getting a variety
of
results
as I continue to mess with this (error codes, misplaced data,
skipped
records).

At this point I'm not even working with the actual form but rather
a
plain
page test document. I think if I can get the plain page worked
out, I
can
apply it to the real thing.

Thanks -- Suzanne

I still think the answer is close.

"Peter Jamieson" wrote:

1. I think it's a bit easier to follow the logic if you stick to
using
one
local variable (and the pattern I suggested before, where you
explicitly
set
LOC to "" in that first record, then test LOC against the value of
MERGEFIELD UICROOM, and set LOC again at the end of the mail merge
main
document.

2. Because of the way this technique works, it's easiest to
imagine
that
the
list of names always comes last. Because you actually want some
notes
etc.
after the list of names, when you use this technique, you then
have
to
put
those notes at the very beginning and eliminate them when
MERGESEQ
is 1
1.
So your merge then looks something like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }{ SET NOTES "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"{ NOTES }
your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{ SET LOC { MERGEFIELD
UICROOM }{ SET NOTES "whatever you want in the notes at the end of
this
group of recordspage or section break }

3. The trouble with this is that the notes under your last list of
names
will never be emitted. But because of the way Word works, I don't
think
you
can logically achieve what you need without also ensuring that you
know
which the last record in each group is. If you know that, e.g.
because
you
mark the last recors in each group, you can do something more
like

{ IF { MERGESEQ } = 1 "{ SET LOC "" }" "" }
{ IF "{ LOC }" = "{ MERGEFIELD UICROOM }"
"your section 1 fields and table
page or {section break
your section 5 page header and column headers" "" }
merge fields you want in the list of names{
{ IF { MERGEFIELD LASTRECORDINGROUP } = "Y" "output your note text
here"
"" }{ SET LOC { MERGEFIELD UICROOM }

Sorry, it's now rather late here so I may not be thinking
straight,
but
Ireally think that's what you need to do.

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

"Suzanne" wrote in message
...
Peter,

You're a lifesaver. Look for my post "I almost have the 2-page
merge"
in
this thread.

When/if you open my Word doc (it's on my Office Live site:
http://suzleigh.com/MERGE.aspx), it will look a little mangled.
Regardless,
I really think that I may almost have this nailed down.

I was able to get this far by creating a new column in my Excel
worksheet:
"UICROOM" -- UIC & ROOM (this might be helpful for anyone in the
future
who
is having the same problem). On plain paper, I get exactly the
results
I'm
looking for. I still can't get the results on the actual form.

If you look at the form, you'll also see that I switched the
pages
to
avoid
having to sift through rows/columns of data to get to the names
listing
(the
name listing is now page 1; the detailed form is page 2).

Would love your help (and/or anyone else who might be listening
in).

Suz

"Peter Jamieson" wrote:

I was away for a couple of days - if you still need a solution
I'll
have
another look.

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

"Suzanne" wrote in message
...
After a full day of hopefully waiting for someone to tell me
that
there
is
some method of doing what I need, I'll close this out and get
on
to
cutting/pasting the data for each record (sigh).

Thanks Peter for your help... Suz

"Suzanne" wrote:

I can't get this working... I've been able to get new
record
breaks
after
each UIC, but have yet to see just the list of names on the
second
page.

A simplified version of what I'm trying to get to:

First Page: UIC BLDG ROOM (followed by rows/columns of
text)
Second Page: All people with the same UIC and Room
(everyone
in
the
room
will have the same building number but not necessarily the
same
UIC)

I can adjust the first page of the form so that one table
cell
will
contain
UIC, BLDG, ROOM. On the top of the second page, I need a
list
of
names
for
that UIC+Room.

Without your help (hopefully), I'm still stuck at having to
manually
Alt-Tab
between two document to cut/paste the information on the
forms.

Thank you VERY much...

Suz

"Peter Jamieson" wrote:

Hi Suzanne

As Doug mentioned in an earlier thread, it's partly a
question
of
"where to
put your page break".

whatever you put in the TRUE result of the IF field
here...

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{
COMPARE
{
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }

" "" }

is going to appear when UIC and ROOM change (so that
probably
needs
to
have
a page break at the end - you can insert one in the result
text)
and
perhaps
you will also need to repeat some of the fields at the
beginning
of
that new
page. i.e. you need something like

{ If { ={ COMPARE { LUIC } { MERGEFIELD UIC } }+{
COMPARE
{
LROOM }

{ MERGEFIELD ROOM } } } = 2
"{ MERGEFIELD UIC }{ MERGEFIELD ROOM }
whatever else you want on page 1 followed by
page break (put a real page break in here)
followed by whatever text and fields you need at the top
of
page
2
" "" }

At the moment, my suggestion assumes that the stuff you
have
in


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
email merge with multiple recipients in "To", "CC" & "BCC" Raghu Mailmerge 6 April 21st 23 12:58 PM
What does "char" "char1" "char2" mean in styles in Word? Li Microsoft Word Help 2 September 5th 07 03:22 PM
Word: 'track changes": have "changed by" rather "del." and "inser Wouter Microsoft Word Help 0 October 26th 06 10:04 AM
The "Symbol" under "Insert" disappeared and replaced by "Number" Eling Microsoft Word Help 3 September 13th 06 03:29 PM
Convert "dragged-in-Pic" to "embedded-Pic" ? Will Microsoft Word Help 1 April 17th 06 11:38 PM


All times are GMT +1. The time now is 04:18 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"