Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
table problems w/ Word 2000 | Tables | |||
How do I hide table columns with text in them, in Word 2000 | Tables | |||
Table headers/footers and layout | Page Layout | |||
How to Avoid Word 2003 Table Style Problems | Tables | |||
Table AutoFormats vs. Table Styles confusion | Tables |