Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
I'm trying to apply an IF statement to a mailmerge field in a document. The
field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
This sounds a tad bizarre unless you have not explained it well.
What difference does it make what the fieldnames are called? It is the record content of those fields that matters. Or do you really have a field called 'Name' which contains these underscored names? In which case { IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } = "Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would probably be nearer the mark? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: I'm trying to apply an IF statement to a mailmerge field in a document. The field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
Hi Graham,
Yes the info is coming from a mergefield. I did originally start with a variation of what you have provided. Sorry my description was a little unclear. I'll give your example a try. Thanks "Graham Mayor" wrote: This sounds a tad bizarre unless you have not explained it well. What difference does it make what the fieldnames are called? It is the record content of those fields that matters. Or do you really have a field called 'Name' which contains these underscored names? In which case { IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } = "Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would probably be nearer the mark? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: I'm trying to apply an IF statement to a mailmerge field in a document. The field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
Hi,
I've tried what you suggested but unfortunately, the field isn't big enough to enter all of the statement. Is there anyway of abbreviating this or is there somewhere else I can enter it? Currently, I'm right-clicking the mergefield, then 'Edit Field', selecting 'If' from the 'Field names' list and then entering the statement in the 'Field Codes:' prompt. "Graham Mayor" wrote: This sounds a tad bizarre unless you have not explained it well. What difference does it make what the fieldnames are called? It is the record content of those fields that matters. Or do you really have a field called 'Name' which contains these underscored names? In which case { IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } = "Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would probably be nearer the mark? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: I'm trying to apply an IF statement to a mailmerge field in a document. The field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
You cannot enter a nested field of this complexity using the field tool.
You will have to enter from the keyboard using CTRL+F9 for each field bracket pair. Nake sure you get the brackets and the quotes in the right places or it won't work - and don't do as I did originally and spell Mergefield incorrectly -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: Hi, I've tried what you suggested but unfortunately, the field isn't big enough to enter all of the statement. Is there anyway of abbreviating this or is there somewhere else I can enter it? Currently, I'm right-clicking the mergefield, then 'Edit Field', selecting 'If' from the 'Field names' list and then entering the statement in the 'Field Codes:' prompt. "Graham Mayor" wrote: This sounds a tad bizarre unless you have not explained it well. What difference does it make what the fieldnames are called? It is the record content of those fields that matters. Or do you really have a field called 'Name' which contains these underscored names? In which case { IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } = "Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would probably be nearer the mark? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: I'm trying to apply an IF statement to a mailmerge field in a document. The field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
Hi Graham,
Thanks once again. I'll see how I get on "Graham Mayor" wrote: You cannot enter a nested field of this complexity using the field tool. You will have to enter from the keyboard using CTRL+F9 for each field bracket pair. Nake sure you get the brackets and the quotes in the right places or it won't work - and don't do as I did originally and spell Mergefield incorrectly -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: Hi, I've tried what you suggested but unfortunately, the field isn't big enough to enter all of the statement. Is there anyway of abbreviating this or is there somewhere else I can enter it? Currently, I'm right-clicking the mergefield, then 'Edit Field', selecting 'If' from the 'Field names' list and then entering the statement in the 'Field Codes:' prompt. "Graham Mayor" wrote: This sounds a tad bizarre unless you have not explained it well. What difference does it make what the fieldnames are called? It is the record content of those fields that matters. Or do you really have a field called 'Name' which contains these underscored names? In which case { IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } = "Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would probably be nearer the mark? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: I'm trying to apply an IF statement to a mailmerge field in a document. The field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
Hi Paul, As Graham suggests, you need to ensure that you get the curly brackets and the quotes in the right places when you're creating your fields and this can be quite tricky if you build up the fields in the "natural" left-to-right way. For an alternative way to construct some types of nested IF fields which I find to be easier to get right, check out the first parts of this thread: http://groups.google.co.uk/group/mic...1a841b aa79cb I won't duplicate the content here as I was just a tab verbose when I wrote my part:-) Regards. Ed "Paul J" wrote: Hi Graham, Thanks once again. I'll see how I get on "Graham Mayor" wrote: You cannot enter a nested field of this complexity using the field tool. You will have to enter from the keyboard using CTRL+F9 for each field bracket pair. Nake sure you get the brackets and the quotes in the right places or it won't work - and don't do as I did originally and spell Mergefield incorrectly -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: Hi, I've tried what you suggested but unfortunately, the field isn't big enough to enter all of the statement. Is there anyway of abbreviating this or is there somewhere else I can enter it? Currently, I'm right-clicking the mergefield, then 'Edit Field', selecting 'If' from the 'Field names' list and then entering the statement in the 'Field Codes:' prompt. "Graham Mayor" wrote: This sounds a tad bizarre unless you have not explained it well. What difference does it make what the fieldnames are called? It is the record content of those fields that matters. Or do you really have a field called 'Name' which contains these underscored names? In which case { IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } = "Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would probably be nearer the mark? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: I'm trying to apply an IF statement to a mailmerge field in a document. The field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
Hi Ed,
"a tab verbose"??? Surely you meant "tad"! Yes, Ed, I did. I spotted it a microsecond after I pressed the Post button. Always the way Thanks for pointing it out. I'm welcome. Regards. Ed "Ed" wrote: Hi Paul, As Graham suggests, you need to ensure that you get the curly brackets and the quotes in the right places when you're creating your fields and this can be quite tricky if you build up the fields in the "natural" left-to-right way. For an alternative way to construct some types of nested IF fields which I find to be easier to get right, check out the first parts of this thread: http://groups.google.co.uk/group/mic...1a841b aa79cb I won't duplicate the content here as I was just a tab verbose when I wrote my part:-) Regards. Ed "Paul J" wrote: Hi Graham, Thanks once again. I'll see how I get on "Graham Mayor" wrote: You cannot enter a nested field of this complexity using the field tool. You will have to enter from the keyboard using CTRL+F9 for each field bracket pair. Nake sure you get the brackets and the quotes in the right places or it won't work - and don't do as I did originally and spell Mergefield incorrectly -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: Hi, I've tried what you suggested but unfortunately, the field isn't big enough to enter all of the statement. Is there anyway of abbreviating this or is there somewhere else I can enter it? Currently, I'm right-clicking the mergefield, then 'Edit Field', selecting 'If' from the 'Field names' list and then entering the statement in the 'Field Codes:' prompt. "Graham Mayor" wrote: This sounds a tad bizarre unless you have not explained it well. What difference does it make what the fieldnames are called? It is the record content of those fields that matters. Or do you really have a field called 'Name' which contains these underscored names? In which case { IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } = "Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would probably be nearer the mark? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: I'm trying to apply an IF statement to a mailmerge field in a document. The field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
#9
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
Hi Ed,
Many thanks for that. I have checked the thread and tried the following. However, all that prints out is 'Mergefield'. I'm obviously still going wrong somewhe { if { Mergefield UserResponseAssignedTo } = "Orla_Byrne" "Orla Byrne" "{ IF {Mergefield UserResponseAssignedTo } = "Brenda Corrigan" "Brenda Corrigan" "{ IF { Mergefield UserResponseAssignedTo } = "Ingrid_Dempsey" "Ingrid Dempsey" "{ IF { Mergefield UserResponseAssignedTo } = "Laura_O'Carroll" "Laura O'Carroll" "{ Mergefield UserResponseAssignedTo}" }" }" }" } Thanks Paul "Ed" wrote: Hi Ed, "a tab verbose"??? Surely you meant "tad"! Yes, Ed, I did. I spotted it a microsecond after I pressed the Post button. Always the way Thanks for pointing it out. I'm welcome. Regards. Ed "Ed" wrote: Hi Paul, As Graham suggests, you need to ensure that you get the curly brackets and the quotes in the right places when you're creating your fields and this can be quite tricky if you build up the fields in the "natural" left-to-right way. For an alternative way to construct some types of nested IF fields which I find to be easier to get right, check out the first parts of this thread: http://groups.google.co.uk/group/mic...1a841b aa79cb I won't duplicate the content here as I was just a tab verbose when I wrote my part:-) Regards. Ed "Paul J" wrote: Hi Graham, Thanks once again. I'll see how I get on "Graham Mayor" wrote: You cannot enter a nested field of this complexity using the field tool. You will have to enter from the keyboard using CTRL+F9 for each field bracket pair. Nake sure you get the brackets and the quotes in the right places or it won't work - and don't do as I did originally and spell Mergefield incorrectly -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: Hi, I've tried what you suggested but unfortunately, the field isn't big enough to enter all of the statement. Is there anyway of abbreviating this or is there somewhere else I can enter it? Currently, I'm right-clicking the mergefield, then 'Edit Field', selecting 'If' from the 'Field names' list and then entering the statement in the 'Field Codes:' prompt. "Graham Mayor" wrote: This sounds a tad bizarre unless you have not explained it well. What difference does it make what the fieldnames are called? It is the record content of those fields that matters. Or do you really have a field called 'Name' which contains these underscored names? In which case { IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } = "Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would probably be nearer the mark? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: I'm trying to apply an IF statement to a mailmerge field in a document. The field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
#10
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
Hi Paul,
To me the structure looks OK. Any chance you've used the curly brackets on the keyboard to insert some of the field braces? When you create fields manually you need to use CTRL+F9. There are a couple of ways to tell. By default at least, the "true" field braces look bolder than ordinary curly brackets. Also, try selecting each field brace in turn and see what shows as selected. My guess would be the final { Mergefield UserResponseAssignedTo}. Regards. Ed "Paul J" wrote: Hi Ed, Many thanks for that. I have checked the thread and tried the following. However, all that prints out is 'Mergefield'. I'm obviously still going wrong somewhe { if { Mergefield UserResponseAssignedTo } = "Orla_Byrne" "Orla Byrne" "{ IF {Mergefield UserResponseAssignedTo } = "Brenda Corrigan" "Brenda Corrigan" "{ IF { Mergefield UserResponseAssignedTo } = "Ingrid_Dempsey" "Ingrid Dempsey" "{ IF { Mergefield UserResponseAssignedTo } = "Laura_O'Carroll" "Laura O'Carroll" "{ Mergefield UserResponseAssignedTo}" }" }" }" } Thanks Paul "Ed" wrote: Hi Ed, "a tab verbose"??? Surely you meant "tad"! Yes, Ed, I did. I spotted it a microsecond after I pressed the Post button. Always the way Thanks for pointing it out. I'm welcome. Regards. Ed "Ed" wrote: Hi Paul, As Graham suggests, you need to ensure that you get the curly brackets and the quotes in the right places when you're creating your fields and this can be quite tricky if you build up the fields in the "natural" left-to-right way. For an alternative way to construct some types of nested IF fields which I find to be easier to get right, check out the first parts of this thread: http://groups.google.co.uk/group/mic...1a841b aa79cb I won't duplicate the content here as I was just a tab verbose when I wrote my part:-) Regards. Ed "Paul J" wrote: Hi Graham, Thanks once again. I'll see how I get on "Graham Mayor" wrote: You cannot enter a nested field of this complexity using the field tool. You will have to enter from the keyboard using CTRL+F9 for each field bracket pair. Nake sure you get the brackets and the quotes in the right places or it won't work - and don't do as I did originally and spell Mergefield incorrectly -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: Hi, I've tried what you suggested but unfortunately, the field isn't big enough to enter all of the statement. Is there anyway of abbreviating this or is there somewhere else I can enter it? Currently, I'm right-clicking the mergefield, then 'Edit Field', selecting 'If' from the 'Field names' list and then entering the statement in the 'Field Codes:' prompt. "Graham Mayor" wrote: This sounds a tad bizarre unless you have not explained it well. What difference does it make what the fieldnames are called? It is the record content of those fields that matters. Or do you really have a field called 'Name' which contains these underscored names? In which case { IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } = "Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would probably be nearer the mark? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: I'm trying to apply an IF statement to a mailmerge field in a document. The field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
#11
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
Hi Ed,
Thats exactly what it was. Many thanks for all your help. Paul "Ed" wrote: Hi Paul, To me the structure looks OK. Any chance you've used the curly brackets on the keyboard to insert some of the field braces? When you create fields manually you need to use CTRL+F9. There are a couple of ways to tell. By default at least, the "true" field braces look bolder than ordinary curly brackets. Also, try selecting each field brace in turn and see what shows as selected. My guess would be the final { Mergefield UserResponseAssignedTo}. Regards. Ed "Paul J" wrote: Hi Ed, Many thanks for that. I have checked the thread and tried the following. However, all that prints out is 'Mergefield'. I'm obviously still going wrong somewhe { if { Mergefield UserResponseAssignedTo } = "Orla_Byrne" "Orla Byrne" "{ IF {Mergefield UserResponseAssignedTo } = "Brenda Corrigan" "Brenda Corrigan" "{ IF { Mergefield UserResponseAssignedTo } = "Ingrid_Dempsey" "Ingrid Dempsey" "{ IF { Mergefield UserResponseAssignedTo } = "Laura_O'Carroll" "Laura O'Carroll" "{ Mergefield UserResponseAssignedTo}" }" }" }" } Thanks Paul "Ed" wrote: Hi Ed, "a tab verbose"??? Surely you meant "tad"! Yes, Ed, I did. I spotted it a microsecond after I pressed the Post button. Always the way Thanks for pointing it out. I'm welcome. Regards. Ed "Ed" wrote: Hi Paul, As Graham suggests, you need to ensure that you get the curly brackets and the quotes in the right places when you're creating your fields and this can be quite tricky if you build up the fields in the "natural" left-to-right way. For an alternative way to construct some types of nested IF fields which I find to be easier to get right, check out the first parts of this thread: http://groups.google.co.uk/group/mic...1a841b aa79cb I won't duplicate the content here as I was just a tab verbose when I wrote my part:-) Regards. Ed "Paul J" wrote: Hi Graham, Thanks once again. I'll see how I get on "Graham Mayor" wrote: You cannot enter a nested field of this complexity using the field tool. You will have to enter from the keyboard using CTRL+F9 for each field bracket pair. Nake sure you get the brackets and the quotes in the right places or it won't work - and don't do as I did originally and spell Mergefield incorrectly -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: Hi, I've tried what you suggested but unfortunately, the field isn't big enough to enter all of the statement. Is there anyway of abbreviating this or is there somewhere else I can enter it? Currently, I'm right-clicking the mergefield, then 'Edit Field', selecting 'If' from the 'Field names' list and then entering the statement in the 'Field Codes:' prompt. "Graham Mayor" wrote: This sounds a tad bizarre unless you have not explained it well. What difference does it make what the fieldnames are called? It is the record content of those fields that matters. Or do you really have a field called 'Name' which contains these underscored names? In which case { IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } = "Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would probably be nearer the mark? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: I'm trying to apply an IF statement to a mailmerge field in a document. The field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
#12
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
IF statement
You're welcome.
Regards. Ed "Paul J" wrote: Hi Ed, Thats exactly what it was. Many thanks for all your help. Paul "Ed" wrote: Hi Paul, To me the structure looks OK. Any chance you've used the curly brackets on the keyboard to insert some of the field braces? When you create fields manually you need to use CTRL+F9. There are a couple of ways to tell. By default at least, the "true" field braces look bolder than ordinary curly brackets. Also, try selecting each field brace in turn and see what shows as selected. My guess would be the final { Mergefield UserResponseAssignedTo}. Regards. Ed "Paul J" wrote: Hi Ed, Many thanks for that. I have checked the thread and tried the following. However, all that prints out is 'Mergefield'. I'm obviously still going wrong somewhe { if { Mergefield UserResponseAssignedTo } = "Orla_Byrne" "Orla Byrne" "{ IF {Mergefield UserResponseAssignedTo } = "Brenda Corrigan" "Brenda Corrigan" "{ IF { Mergefield UserResponseAssignedTo } = "Ingrid_Dempsey" "Ingrid Dempsey" "{ IF { Mergefield UserResponseAssignedTo } = "Laura_O'Carroll" "Laura O'Carroll" "{ Mergefield UserResponseAssignedTo}" }" }" }" } Thanks Paul "Ed" wrote: Hi Ed, "a tab verbose"??? Surely you meant "tad"! Yes, Ed, I did. I spotted it a microsecond after I pressed the Post button. Always the way Thanks for pointing it out. I'm welcome. Regards. Ed "Ed" wrote: Hi Paul, As Graham suggests, you need to ensure that you get the curly brackets and the quotes in the right places when you're creating your fields and this can be quite tricky if you build up the fields in the "natural" left-to-right way. For an alternative way to construct some types of nested IF fields which I find to be easier to get right, check out the first parts of this thread: http://groups.google.co.uk/group/mic...1a841b aa79cb I won't duplicate the content here as I was just a tab verbose when I wrote my part:-) Regards. Ed "Paul J" wrote: Hi Graham, Thanks once again. I'll see how I get on "Graham Mayor" wrote: You cannot enter a nested field of this complexity using the field tool. You will have to enter from the keyboard using CTRL+F9 for each field bracket pair. Nake sure you get the brackets and the quotes in the right places or it won't work - and don't do as I did originally and spell Mergefield incorrectly -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: Hi, I've tried what you suggested but unfortunately, the field isn't big enough to enter all of the statement. Is there anyway of abbreviating this or is there somewhere else I can enter it? Currently, I'm right-clicking the mergefield, then 'Edit Field', selecting 'If' from the 'Field names' list and then entering the statement in the 'Field Codes:' prompt. "Graham Mayor" wrote: This sounds a tad bizarre unless you have not explained it well. What difference does it make what the fieldnames are called? It is the record content of those fields that matters. Or do you really have a field called 'Name' which contains these underscored names? In which case { IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } = "Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would probably be nearer the mark? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Paul J wrote: I'm trying to apply an IF statement to a mailmerge field in a document. The field in question is a 'Name' and is stored in the database as, for example, 'Paul_Jacques'. What I want to do is strip out the underscore and replace it with a SPACE. I've tried the following: IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF "Anthony_Robinson" "Anthony Robinson" Although it seems to accept the entry, on the print itself it only ever prints "Paul Jacques" regardless of the relevant name. What have I done wrong? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using an If Statement | Mailmerge | |||
which statement right , question is Choose the correct statement? | Microsoft Word Help | |||
which statement right , question isChoose the correct statement? | Microsoft Word Help | |||
using iif statement | Mailmerge | |||
How can I? If statement ? | Mailmerge |