Reply
 
Thread Tools Display Modes
  #1   Report Post  
GTS
 
Posts: n/a
Default Lookup table error Word 2000

A mail merge document working fine but some data not available and we use a
lookup table (Excel) to add the required fields. It has worked fine for
adding an email address and a job description based on the merged user name.
However trying to add another database lookup is causing a real headache!
Although the lookup is structured indentically to the first two, the merge
always stops with an error "Unable to insert data as the query result is
empty" - however when you click OK the correct data IS inserted into the
resulting letter! As these merges are unattended I need to sort this out...
I did first try a SET statement but that did'nt work, I think because there
were too many nested IF statements (about 40 nested) - what is the limit on
nested IF's in Word?
TIA
Graham


  #2   Report Post  
macropod
 
Posts: n/a
Default Lookup table error Word 2000

Hi Graham,

You can nest to a maximum of 20 IF statements. However, you should be able
to achieve the required outcome with no more than this, by restructuring the
IF statements and/or using a second SET field to pick up where the first one
left off.

Cheers


"GTS" wrote in message
...
A mail merge document working fine but some data not available and we use

a
lookup table (Excel) to add the required fields. It has worked fine for
adding an email address and a job description based on the merged user

name.
However trying to add another database lookup is causing a real headache!
Although the lookup is structured indentically to the first two, the merge
always stops with an error "Unable to insert data as the query result is
empty" - however when you click OK the correct data IS inserted into the
resulting letter! As these merges are unattended I need to sort this

out...
I did first try a SET statement but that did'nt work, I think because

there
were too many nested IF statements (about 40 nested) - what is the limit

on
nested IF's in Word?
TIA
Graham




  #3   Report Post  
GTS
 
Posts: n/a
Default Lookup table error Word 2000

Thanks for the idea. If I use a second SET statement, can I then use the
resulting bookmarks in an IF statement?
For example if the first SET results in a blank field, but the second SET
picks up what I want, can I then say {IF {FIRSTSETBOOKMARK} "",
"{FIRSTSETBOOKMARK}","SECONDSETBOOKMARK"
I just don't know if you can use bookmarks / cross-references in an IF
statement. Also I notice that bookmarks created from a SET statement always
have a blank space added to them for some reason!
Graham
"macropod" wrote in message
...
Hi Graham,

You can nest to a maximum of 20 IF statements. However, you should be able
to achieve the required outcome with no more than this, by restructuring

the
IF statements and/or using a second SET field to pick up where the first

one
left off.

Cheers


"GTS" wrote in message
...
A mail merge document working fine but some data not available and we

use
a
lookup table (Excel) to add the required fields. It has worked fine for
adding an email address and a job description based on the merged user

name.
However trying to add another database lookup is causing a real

headache!
Although the lookup is structured indentically to the first two, the

merge
always stops with an error "Unable to insert data as the query result is
empty" - however when you click OK the correct data IS inserted into the
resulting letter! As these merges are unattended I need to sort this

out...
I did first try a SET statement but that did'nt work, I think because

there
were too many nested IF statements (about 40 nested) - what is the limit

on
nested IF's in Word?
TIA
Graham






  #4   Report Post  
macropod
 
Posts: n/a
Default Lookup table error Word 2000

Hi Graham,

If you use a SET field to create a bookmark in the form of:
{SET BkMrk1 "Bookmarked text/field"}
That does not add an extra space to the bookmark name - you get a bookmark
named 'BkMrk1'.

To use this for a second series of IF tests, you could use:
{IF{BkMrk1}= "" {IF{MERGEFIELD DataField21}= 5 True False}}}
where either or both of the 'True' and 'False' results could be the
continuation of your nested IFs.

Alternatively, you could use something like:
{SET BkMrk1 {IF{MERGEFIELD DataField21}= 5 True False}}}
for the first bookmark and
{SET BkMrk2 {IF{MERGEFIELD DataField21}= 5 True False}}}
for the second bookmark, which you could then combine into a final IF test
along the lines of:
{IF{BkMrk1}= "" {BkMrk2}}

The other thing you might want to consider, depending on what you're trying
to achieve, is the use of COMPARE, AND and OR tests.

As for using operators like '' or '', you need to be careful if you're
comparing text outputs (your post doesn't indicate the nature of the data),
but they certainly can be used.

Finally, if all of your data and the True/False results are numeric, you can
simplify the IF field syntax, down to:
{=IF{MERGEFIELD DataField21}=1,2,3}

Cheers


"GTS" wrote in message
...
Thanks for the idea. If I use a second SET statement, can I then use the
resulting bookmarks in an IF statement?
For example if the first SET results in a blank field, but the second SET
picks up what I want, can I then say {IF {FIRSTSETBOOKMARK} "",
"{FIRSTSETBOOKMARK}","SECONDSETBOOKMARK"
I just don't know if you can use bookmarks / cross-references in an IF
statement. Also I notice that bookmarks created from a SET statement

always
have a blank space added to them for some reason!
Graham
"macropod" wrote in message
...
Hi Graham,

You can nest to a maximum of 20 IF statements. However, you should be

able
to achieve the required outcome with no more than this, by restructuring

the
IF statements and/or using a second SET field to pick up where the first

one
left off.

Cheers


"GTS" wrote in message
...
A mail merge document working fine but some data not available and we

use
a
lookup table (Excel) to add the required fields. It has worked fine

for
adding an email address and a job description based on the merged user

name.
However trying to add another database lookup is causing a real

headache!
Although the lookup is structured indentically to the first two, the

merge
always stops with an error "Unable to insert data as the query result

is
empty" - however when you click OK the correct data IS inserted into

the
resulting letter! As these merges are unattended I need to sort this

out...
I did first try a SET statement but that did'nt work, I think because

there
were too many nested IF statements (about 40 nested) - what is the

limit
on
nested IF's in Word?
TIA
Graham








  #5   Report Post  
GTS
 
Posts: n/a
Default Lookup table error Word 2000

Thank you!
However my SET statement does add a space to the end of the bookmark for
some reason - for example;
{ SET BKMRK1 "{IF {MERGEFIELD AREA} = "SW1" "OFFICER1NAME" "{IF {MERGEFIELD
AREA} = "SW2" "OFFICER2NAME" "IF......etc etc
I do end up with a bookmark with the correct name in, but a blank space on
the end so "OFFICER1NAME" becomes "OFFICER1NAME " - and this does make a
difference because later I use an INCLUDEPICTURE statement to add the
correct signature!
Graham
"macropod" wrote in message
...
Hi Graham,

If you use a SET field to create a bookmark in the form of:
{SET BkMrk1 "Bookmarked text/field"}
That does not add an extra space to the bookmark name - you get a bookmark
named 'BkMrk1'.

To use this for a second series of IF tests, you could use:
{IF{BkMrk1}= "" {IF{MERGEFIELD DataField21}= 5 True False}}}
where either or both of the 'True' and 'False' results could be the
continuation of your nested IFs.

Alternatively, you could use something like:
{SET BkMrk1 {IF{MERGEFIELD DataField21}= 5 True False}}}
for the first bookmark and
{SET BkMrk2 {IF{MERGEFIELD DataField21}= 5 True False}}}
for the second bookmark, which you could then combine into a final IF test
along the lines of:
{IF{BkMrk1}= "" {BkMrk2}}

The other thing you might want to consider, depending on what you're

trying
to achieve, is the use of COMPARE, AND and OR tests.

As for using operators like '' or '', you need to be careful if you're
comparing text outputs (your post doesn't indicate the nature of the

data),
but they certainly can be used.

Finally, if all of your data and the True/False results are numeric, you

can
simplify the IF field syntax, down to:
{=IF{MERGEFIELD DataField21}=1,2,3}

Cheers


"GTS" wrote in message
...
Thanks for the idea. If I use a second SET statement, can I then use the
resulting bookmarks in an IF statement?
For example if the first SET results in a blank field, but the second

SET
picks up what I want, can I then say {IF {FIRSTSETBOOKMARK} "",
"{FIRSTSETBOOKMARK}","SECONDSETBOOKMARK"
I just don't know if you can use bookmarks / cross-references in an IF
statement. Also I notice that bookmarks created from a SET statement

always
have a blank space added to them for some reason!
Graham
"macropod" wrote in message
...
Hi Graham,

You can nest to a maximum of 20 IF statements. However, you should be

able
to achieve the required outcome with no more than this, by

restructuring
the
IF statements and/or using a second SET field to pick up where the

first
one
left off.

Cheers


"GTS" wrote in message
...
A mail merge document working fine but some data not available and

we
use
a
lookup table (Excel) to add the required fields. It has worked fine

for
adding an email address and a job description based on the merged

user
name.
However trying to add another database lookup is causing a real

headache!
Although the lookup is structured indentically to the first two, the

merge
always stops with an error "Unable to insert data as the query

result
is
empty" - however when you click OK the correct data IS inserted into

the
resulting letter! As these merges are unattended I need to sort this
out...
I did first try a SET statement but that did'nt work, I think

because
there
were too many nested IF statements (about 40 nested) - what is the

limit
on
nested IF's in Word?
TIA
Graham












  #6   Report Post  
macropod
 
Posts: n/a
Default Lookup table error Word 2000

Hi Graham,

Try using:
{SET BKMRK1 {IF{MERGEFIELD AREA}= SW1 "OFFICER1NAME" {IF{MERGEFIELD AREA}=
SW2 "OFFICER2NAME" {IF......etc etc
that is, without the quotes - you can also delete the quotes for
OFFICER1NAME etc if those values are single words. The only reasons I can
think of for OFFICER1NAME etc to get an extra space is if the bookmark value
is coded as "OFFICER1NAME " or something such, with the extra space(s)
inside the quote marks.

Cheers

"GTS" wrote in message
...
Thank you!
However my SET statement does add a space to the end of the bookmark for
some reason - for example;
{ SET BKMRK1 "{IF {MERGEFIELD AREA} = "SW1" "OFFICER1NAME" "{IF

{MERGEFIELD
AREA} = "SW2" "OFFICER2NAME" "IF......etc etc
I do end up with a bookmark with the correct name in, but a blank space on
the end so "OFFICER1NAME" becomes "OFFICER1NAME " - and this does make a
difference because later I use an INCLUDEPICTURE statement to add the
correct signature!
Graham
"macropod" wrote in message
...
Hi Graham,

If you use a SET field to create a bookmark in the form of:
{SET BkMrk1 "Bookmarked text/field"}
That does not add an extra space to the bookmark name - you get a

bookmark
named 'BkMrk1'.

To use this for a second series of IF tests, you could use:
{IF{BkMrk1}= "" {IF{MERGEFIELD DataField21}= 5 True False}}}
where either or both of the 'True' and 'False' results could be the
continuation of your nested IFs.

Alternatively, you could use something like:
{SET BkMrk1 {IF{MERGEFIELD DataField21}= 5 True False}}}
for the first bookmark and
{SET BkMrk2 {IF{MERGEFIELD DataField21}= 5 True False}}}
for the second bookmark, which you could then combine into a final IF

test
along the lines of:
{IF{BkMrk1}= "" {BkMrk2}}

The other thing you might want to consider, depending on what you're

trying
to achieve, is the use of COMPARE, AND and OR tests.

As for using operators like '' or '', you need to be careful if you're
comparing text outputs (your post doesn't indicate the nature of the

data),
but they certainly can be used.

Finally, if all of your data and the True/False results are numeric, you

can
simplify the IF field syntax, down to:
{=IF{MERGEFIELD DataField21}=1,2,3}

Cheers


"GTS" wrote in message
...
Thanks for the idea. If I use a second SET statement, can I then use

the
resulting bookmarks in an IF statement?
For example if the first SET results in a blank field, but the second

SET
picks up what I want, can I then say {IF {FIRSTSETBOOKMARK} "",
"{FIRSTSETBOOKMARK}","SECONDSETBOOKMARK"
I just don't know if you can use bookmarks / cross-references in an IF
statement. Also I notice that bookmarks created from a SET statement

always
have a blank space added to them for some reason!
Graham
"macropod" wrote in message
...
Hi Graham,

You can nest to a maximum of 20 IF statements. However, you should

be
able
to achieve the required outcome with no more than this, by

restructuring
the
IF statements and/or using a second SET field to pick up where the

first
one
left off.

Cheers


"GTS" wrote in message
...
A mail merge document working fine but some data not available and

we
use
a
lookup table (Excel) to add the required fields. It has worked

fine
for
adding an email address and a job description based on the merged

user
name.
However trying to add another database lookup is causing a real
headache!
Although the lookup is structured indentically to the first two,

the
merge
always stops with an error "Unable to insert data as the query

result
is
empty" - however when you click OK the correct data IS inserted

into
the
resulting letter! As these merges are unattended I need to sort

this
out...
I did first try a SET statement but that did'nt work, I think

because
there
were too many nested IF statements (about 40 nested) - what is the

limit
on
nested IF's in Word?
TIA
Graham












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
table problems w/ Word 2000 mschade Tables 3 August 2nd 05 09:29 PM
How do I hide table columns with text in them, in Word 2000 KGZ Tables 3 May 7th 05 01:04 AM
Table headers/footers and layout Keith Page Layout 1 April 8th 05 07:37 PM
How to Avoid Word 2003 Table Style Problems Judy Haynes Tables 0 March 23rd 05 06:41 PM
Table AutoFormats vs. Table Styles confusion Tony Jollans Tables 5 March 6th 05 07:18 PM


All times are GMT +1. The time now is 05:59 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"