Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
I am using Access 2002 to set up a mail merge letter and envelope. Some of
the records in my Access database don't have all of the name and address fields. In older versions of Access that I used in the past, I was able to use an "IF" field to to essentially say that if the field existed to add a space after it, otherwise don't add the space. i.e. one record has a "middlename" field, another doesn't. I don't want the one without the middlename field to have two spaces between first and last name, which would happen if I hard coded the spaces in. Same thing if a record doesn't have a salutation field, or perhaps a title field. How can I use if messages and/or switches to best set this up? Can it be done both ways? If so, I would appreciate getting info on both, and the reasons to prefer one or the other. Thanks. -- Larry S |
#2
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
You can use either an If() function in an Access query or an
If...then...Else... field in the mail merge main document. For the latter the construction would be { MERGEFIELD firstname } { IF { MERGEFIELD middleinitial } "" "{ MERGEFIELD middleinitial } { MERGEFIELD lastname }" "{ MERGEFIELD lastname }" } However, I would always manipulate the data in the database. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Larry S." wrote in message ... I am using Access 2002 to set up a mail merge letter and envelope. Some of the records in my Access database don't have all of the name and address fields. In older versions of Access that I used in the past, I was able to use an "IF" field to to essentially say that if the field existed to add a space after it, otherwise don't add the space. i.e. one record has a "middlename" field, another doesn't. I don't want the one without the middlename field to have two spaces between first and last name, which would happen if I hard coded the spaces in. Same thing if a record doesn't have a salutation field, or perhaps a title field. How can I use if messages and/or switches to best set this up? Can it be done both ways? If so, I would appreciate getting info on both, and the reasons to prefer one or the other. Thanks. -- Larry S |
#3
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Hi Doug,
Thanks for your answer. How can I get two different entries as a response to the IF statement. The way I want to use this is that if the middle name exists, to print the middle name THEN ADD A SPACE. In other words to insert both a field and selected text after that field. I can also see using this to add things like commas and periods, depending on the context. The WORD help files seem to have limited information on these kind of issues. Is there a site that I can use as a resource that would give me full help files on things like conditional statements, switches, etc? If so, what would you recommend? The idea of using the database queries to manipulate the data sounds good, but I'm not sure just how to do that. I used to work with SQL some years ago, but frankly have forgotten much of what I knew. Are there options in Access that would let me do this directly, or do I need to write these statements directly into the SQL ? In either case, and clues you can give me as to how to do it and where to find more info for what I'm not sure of will be helpful. Thanks. -- Larry S "Doug Robbins - Word MVP" wrote: You can use either an If() function in an Access query or an If...then...Else... field in the mail merge main document. For the latter the construction would be { MERGEFIELD firstname } { IF { MERGEFIELD middleinitial } "" "{ MERGEFIELD middleinitial } { MERGEFIELD lastname }" "{ MERGEFIELD lastname }" } However, I would always manipulate the data in the database. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Larry S." wrote in message ... I am using Access 2002 to set up a mail merge letter and envelope. Some of the records in my Access database don't have all of the name and address fields. In older versions of Access that I used in the past, I was able to use an "IF" field to to essentially say that if the field existed to add a space after it, otherwise don't add the space. i.e. one record has a "middlename" field, another doesn't. I don't want the one without the middlename field to have two spaces between first and last name, which would happen if I hard coded the spaces in. Same thing if a record doesn't have a salutation field, or perhaps a title field. How can I use if messages and/or switches to best set this up? Can it be done both ways? If so, I would appreciate getting info on both, and the reasons to prefer one or the other. Thanks. -- Larry S |
#4
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Use the field construction that I gave you. You must use Ctrl+F9 to insert
each pair of field delimiters and just change the names of the mergefields that I used in the example to the names of the fields in your data source. Use Alt+F9 to toggle the display of the field codes. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Larry S." wrote in message ... Hi Doug, Thanks for your answer. How can I get two different entries as a response to the IF statement. The way I want to use this is that if the middle name exists, to print the middle name THEN ADD A SPACE. In other words to insert both a field and selected text after that field. I can also see using this to add things like commas and periods, depending on the context. The WORD help files seem to have limited information on these kind of issues. Is there a site that I can use as a resource that would give me full help files on things like conditional statements, switches, etc? If so, what would you recommend? The idea of using the database queries to manipulate the data sounds good, but I'm not sure just how to do that. I used to work with SQL some years ago, but frankly have forgotten much of what I knew. Are there options in Access that would let me do this directly, or do I need to write these statements directly into the SQL ? In either case, and clues you can give me as to how to do it and where to find more info for what I'm not sure of will be helpful. Thanks. -- Larry S "Doug Robbins - Word MVP" wrote: You can use either an If() function in an Access query or an If...then...Else... field in the mail merge main document. For the latter the construction would be { MERGEFIELD firstname } { IF { MERGEFIELD middleinitial } "" "{ MERGEFIELD middleinitial } { MERGEFIELD lastname }" "{ MERGEFIELD lastname }" } However, I would always manipulate the data in the database. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Larry S." wrote in message ... I am using Access 2002 to set up a mail merge letter and envelope. Some of the records in my Access database don't have all of the name and address fields. In older versions of Access that I used in the past, I was able to use an "IF" field to to essentially say that if the field existed to add a space after it, otherwise don't add the space. i.e. one record has a "middlename" field, another doesn't. I don't want the one without the middlename field to have two spaces between first and last name, which would happen if I hard coded the spaces in. Same thing if a record doesn't have a salutation field, or perhaps a title field. How can I use if messages and/or switches to best set this up? Can it be done both ways? If so, I would appreciate getting info on both, and the reasons to prefer one or the other. Thanks. -- Larry S |
#5
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
OK, Thanks. Any suggestions on how to make the changes in the database if I
want to go that route? Would I do that in SQL? -- Larry S "Doug Robbins - Word MVP" wrote: Use the field construction that I gave you. You must use Ctrl+F9 to insert each pair of field delimiters and just change the names of the mergefields that I used in the example to the names of the fields in your data source. Use Alt+F9 to toggle the display of the field codes. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Larry S." wrote in message ... Hi Doug, Thanks for your answer. How can I get two different entries as a response to the IF statement. The way I want to use this is that if the middle name exists, to print the middle name THEN ADD A SPACE. In other words to insert both a field and selected text after that field. I can also see using this to add things like commas and periods, depending on the context. The WORD help files seem to have limited information on these kind of issues. Is there a site that I can use as a resource that would give me full help files on things like conditional statements, switches, etc? If so, what would you recommend? The idea of using the database queries to manipulate the data sounds good, but I'm not sure just how to do that. I used to work with SQL some years ago, but frankly have forgotten much of what I knew. Are there options in Access that would let me do this directly, or do I need to write these statements directly into the SQL ? In either case, and clues you can give me as to how to do it and where to find more info for what I'm not sure of will be helpful. Thanks. -- Larry S "Doug Robbins - Word MVP" wrote: You can use either an If() function in an Access query or an If...then...Else... field in the mail merge main document. For the latter the construction would be { MERGEFIELD firstname } { IF { MERGEFIELD middleinitial } "" "{ MERGEFIELD middleinitial } { MERGEFIELD lastname }" "{ MERGEFIELD lastname }" } However, I would always manipulate the data in the database. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Larry S." wrote in message ... I am using Access 2002 to set up a mail merge letter and envelope. Some of the records in my Access database don't have all of the name and address fields. In older versions of Access that I used in the past, I was able to use an "IF" field to to essentially say that if the field existed to add a space after it, otherwise don't add the space. i.e. one record has a "middlename" field, another doesn't. I don't want the one without the middlename field to have two spaces between first and last name, which would happen if I hard coded the spaces in. Same thing if a record doesn't have a salutation field, or perhaps a title field. How can I use if messages and/or switches to best set this up? Can it be done both ways? If so, I would appreciate getting info on both, and the reasons to prefer one or the other. Thanks. -- Larry S |
#6
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Use a query in Access.
-- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Larry S." wrote in message ... OK, Thanks. Any suggestions on how to make the changes in the database if I want to go that route? Would I do that in SQL? -- Larry S "Doug Robbins - Word MVP" wrote: Use the field construction that I gave you. You must use Ctrl+F9 to insert each pair of field delimiters and just change the names of the mergefields that I used in the example to the names of the fields in your data source. Use Alt+F9 to toggle the display of the field codes. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Larry S." wrote in message ... Hi Doug, Thanks for your answer. How can I get two different entries as a response to the IF statement. The way I want to use this is that if the middle name exists, to print the middle name THEN ADD A SPACE. In other words to insert both a field and selected text after that field. I can also see using this to add things like commas and periods, depending on the context. The WORD help files seem to have limited information on these kind of issues. Is there a site that I can use as a resource that would give me full help files on things like conditional statements, switches, etc? If so, what would you recommend? The idea of using the database queries to manipulate the data sounds good, but I'm not sure just how to do that. I used to work with SQL some years ago, but frankly have forgotten much of what I knew. Are there options in Access that would let me do this directly, or do I need to write these statements directly into the SQL ? In either case, and clues you can give me as to how to do it and where to find more info for what I'm not sure of will be helpful. Thanks. -- Larry S "Doug Robbins - Word MVP" wrote: You can use either an If() function in an Access query or an If...then...Else... field in the mail merge main document. For the latter the construction would be { MERGEFIELD firstname } { IF { MERGEFIELD middleinitial } "" "{ MERGEFIELD middleinitial } { MERGEFIELD lastname }" "{ MERGEFIELD lastname }" } However, I would always manipulate the data in the database. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Larry S." wrote in message ... I am using Access 2002 to set up a mail merge letter and envelope. Some of the records in my Access database don't have all of the name and address fields. In older versions of Access that I used in the past, I was able to use an "IF" field to to essentially say that if the field existed to add a space after it, otherwise don't add the space. i.e. one record has a "middlename" field, another doesn't. I don't want the one without the middlename field to have two spaces between first and last name, which would happen if I hard coded the spaces in. Same thing if a record doesn't have a salutation field, or perhaps a title field. How can I use if messages and/or switches to best set this up? Can it be done both ways? If so, I would appreciate getting info on both, and the reasons to prefer one or the other. Thanks. -- Larry S |
#7
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
You can use conditional fields exactly as before.
{IF {Mergefield Fieldname} "" "{Mergefield Fieldname} "} will add the field and a following space if the field has content. Otherwise it does nothing. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Larry S. wrote: I am using Access 2002 to set up a mail merge letter and envelope. Some of the records in my Access database don't have all of the name and address fields. In older versions of Access that I used in the past, I was able to use an "IF" field to to essentially say that if the field existed to add a space after it, otherwise don't add the space. i.e. one record has a "middlename" field, another doesn't. I don't want the one without the middlename field to have two spaces between first and last name, which would happen if I hard coded the spaces in. Same thing if a record doesn't have a salutation field, or perhaps a title field. How can I use if messages and/or switches to best set this up? Can it be done both ways? If so, I would appreciate getting info on both, and the reasons to prefer one or the other. Thanks. |
#8
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]() -- Larry S Graham, Thanks for getting back to me. From the way you wrote out the "then" clause, it looks like you've added the space by including a space between the closing bracket of Mergefield, and the ending quote. Is this correct? Can I add punctuation such as a comma the same way, by including it between the bracket and the quote? Can I include more than one field by including them both between the quotes, and possibly add a space or punctuation between them by writing "{Mergefield Fieldname1}, {Mergefield Fieldname2}" ? Can you refer me to an online resource that would give me this kind of information, so I can look it up myself as needed? Also, is there a way to add spaces with switches? If so, which would you recommend? Thanks. Larry "Graham Mayor" wrote: You can use conditional fields exactly as before. {IF {Mergefield Fieldname} "" "{Mergefield Fieldname} "} will add the field and a following space if the field has content. Otherwise it does nothing. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Larry S. wrote: I am using Access 2002 to set up a mail merge letter and envelope. Some of the records in my Access database don't have all of the name and address fields. In older versions of Access that I used in the past, I was able to use an "IF" field to to essentially say that if the field existed to add a space after it, otherwise don't add the space. i.e. one record has a "middlename" field, another doesn't. I don't want the one without the middlename field to have two spaces between first and last name, which would happen if I hard coded the spaces in. Same thing if a record doesn't have a salutation field, or perhaps a title field. How can I use if messages and/or switches to best set this up? Can it be done both ways? If so, I would appreciate getting info on both, and the reasons to prefer one or the other. Thanks. |
#9
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
You can add just about anything you want between the quotes including
punctuation, fields, graphics etc. You are simply telling Word to insert that lot if the field has content. You may find http://www.gmayor.com/formatting_word_fields.htm useful. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Larry S. wrote: You can use conditional fields exactly as before. {IF {Mergefield Fieldname} "" "{Mergefield Fieldname} "} will add the field and a following space if the field has content. Otherwise it does nothing. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Larry S. wrote: I am using Access 2002 to set up a mail merge letter and envelope. Some of the records in my Access database don't have all of the name and address fields. In older versions of Access that I used in the past, I was able to use an "IF" field to to essentially say that if the field existed to add a space after it, otherwise don't add the space. i.e. one record has a "middlename" field, another doesn't. I don't want the one without the middlename field to have two spaces between first and last name, which would happen if I hard coded the spaces in. Same thing if a record doesn't have a salutation field, or perhaps a title field. How can I use if messages and/or switches to best set this up? Can it be done both ways? If so, I would appreciate getting info on both, and the reasons to prefer one or the other. Thanks. |
#10
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Hi Graham,
Thanks for your suggestions. I checked out your website, and it is obviously a fantastic resource! For those of us with just enough computer knowledge to be dangerous ![]() around. -- Larry S "Graham Mayor" wrote: You can add just about anything you want between the quotes including punctuation, fields, graphics etc. You are simply telling Word to insert that lot if the field has content. You may find http://www.gmayor.com/formatting_word_fields.htm useful. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Larry S. wrote: You can use conditional fields exactly as before. {IF {Mergefield Fieldname} "" "{Mergefield Fieldname} "} will add the field and a following space if the field has content. Otherwise it does nothing. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Larry S. wrote: I am using Access 2002 to set up a mail merge letter and envelope. Some of the records in my Access database don't have all of the name and address fields. In older versions of Access that I used in the past, I was able to use an "IF" field to to essentially say that if the field existed to add a space after it, otherwise don't add the space. i.e. one record has a "middlename" field, another doesn't. I don't want the one without the middlename field to have two spaces between first and last name, which would happen if I hard coded the spaces in. Same thing if a record doesn't have a salutation field, or perhaps a title field. How can I use if messages and/or switches to best set this up? Can it be done both ways? If so, I would appreciate getting info on both, and the reasons to prefer one or the other. Thanks. |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Mail Merge - removing excess fields | New Users | |||
How do I mail merge a form without losing the form fields when me. | Mailmerge | |||
mail merge and text form fields | Mailmerge | |||
Empty Mail Merge Fields | Microsoft Word Help | |||
Empty Mail Merge Fields | Microsoft Word Help |