Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.access
|
|||
|
|||
Create Mail Merge List/Database in Access 2007
This reply to an existing thread in microsoft.public.access cross-posted to
microsoft.public.word.mailmerge.fields. For those people in the mailmerge.fields group, who are seeing only this portion, the original thread can be found he http://www.microsoft.com/office/comm...4-57b8de2b8f8d ==================================== Hi Renee, I've spent hours trying, but so far I have not had any luck getting this to work correctly. I posted a request for help from other MVPs in Word and Access, and got three responses from Word MVPs. I've tried all of these responses, but still no joy. Here are the responses that I received: ================================= First respondent In this case, from what the OP posted, I would say that she has probably typed the {} around the INCLUDEPICTURE field, rather than using the special field braces you can insert using ctrl-F9. However, you also have to: a. either double up all the backslashes in the path name, or use forward slashes b. uncheck Word Tools-Options-General-Web options-Files-Update links on save - otherwise, when you save the mail merge main document, the included field is unlinked, leaving a URL-style path with %20s instead of spaces, and so on. c. select the output document and refresh all the INCLUDEPICTURE fields using F9. (You may find printing directly works, or you may have to set either or both of Word Tools-Options-Print-Update fields and Update links. My experience is that it is also very easy to insert a space that should not be there at the beginning of the file path name, e.g. using { INCLUDEPICTURE " { MERGEFIELD myfield }" } ================================= Second respondent I'm no expert with this stuff but the double backslashes are critical. AFAIK you can't do it in the merge itself (although you could probably manage it in a MailMergeAfterRecordMerge (or maybe MailMergeAfterMerge) Application event) and it would be better if you had a query in your database containing them, on which you could base the merge - unfortunately, again, I don't think this is as easy as it might be. You really need to use the VBA Replace(Photo,"\","\\") function but it doesn't exist as an Access function so you will need to build your own (rather trivial) VBA function and use that in your query. ================================= Third respondent What I find works best is to use Insert | Picture | From File: Link to File to insert a "known-good" path in the IncludePicture field, then base my merge syntax on that. Also, if all the pictures are in a single folder, you can type the entire path except for the actual image filename as part of the field, putting just the image filename in the merge field. ================================= Here are my comments back to each person who provided help: To the first respondent: Thank You very much for your input. On the issue of typing the {}, that's exactly what I was attempting to do. At the time, I was kind of wondering about this, thinking it might be more like an array formula in Excel, but since Cindy didn't mention it on her web page... To the second respondent: Thank You Tony for your input. Actually, Access does have the Replace function available. I believe it was added in Access 2000. Prior to that, folks would code their own replace function, but I imagine that likely wouldn't work since the mail merge functionality is not running msaccess.exe to actually run such a function. One can call this function directly from a query, but only if Sandbox mode is not enabled for Access. ++++++++ However, since writing the above comment back to the second person, I have since discovered that Word Mail Merge does not want to display a SELECT query if it contains a reference to a built-in function, such as the Replace function. So, I ended up manually editing the paths in my database to include the double slashes separating the folders. Still no joy. Perhaps it would be a lot easier to just use Access as your report writer! Tom Wickerath Microsoft Access MVP https://mvp.support.microsoft.com/profile/Tom http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ "Renee B." wrote: I wasn't able to get it to work. I ended up getting the address with the coding instead of the picture. I added the path name to the DB as instructed and then went into Word to do the mail merge. The input was «AddressBlock» { IncludePicture "«PropertyPic»" } which resulted in Jane Doe 1234 5th St SUNRISE, FL 33322 { IncludePicture "xxxx SHADY GLEN DR.jpg" } Any suggestions? |
#2
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.access
|
|||
|
|||
Create Mail Merge List/Database in Access 2007
Is there still an unanswered question here?
-- 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 "Tom Wickerath" AOS168b AT comcast DOT net wrote in message news This reply to an existing thread in microsoft.public.access cross-posted to microsoft.public.word.mailmerge.fields. For those people in the mailmerge.fields group, who are seeing only this portion, the original thread can be found he http://www.microsoft.com/office/comm...4-57b8de2b8f8d ==================================== Hi Renee, I've spent hours trying, but so far I have not had any luck getting this to work correctly. I posted a request for help from other MVPs in Word and Access, and got three responses from Word MVPs. I've tried all of these responses, but still no joy. Here are the responses that I received: ================================= First respondent In this case, from what the OP posted, I would say that she has probably typed the {} around the INCLUDEPICTURE field, rather than using the special field braces you can insert using ctrl-F9. However, you also have to: a. either double up all the backslashes in the path name, or use forward slashes b. uncheck Word Tools-Options-General-Web options-Files-Update links on save - otherwise, when you save the mail merge main document, the included field is unlinked, leaving a URL-style path with %20s instead of spaces, and so on. c. select the output document and refresh all the INCLUDEPICTURE fields using F9. (You may find printing directly works, or you may have to set either or both of Word Tools-Options-Print-Update fields and Update links. My experience is that it is also very easy to insert a space that should not be there at the beginning of the file path name, e.g. using { INCLUDEPICTURE " { MERGEFIELD myfield }" } ================================= Second respondent I'm no expert with this stuff but the double backslashes are critical. AFAIK you can't do it in the merge itself (although you could probably manage it in a MailMergeAfterRecordMerge (or maybe MailMergeAfterMerge) Application event) and it would be better if you had a query in your database containing them, on which you could base the merge - unfortunately, again, I don't think this is as easy as it might be. You really need to use the VBA Replace(Photo,"\","\\") function but it doesn't exist as an Access function so you will need to build your own (rather trivial) VBA function and use that in your query. ================================= Third respondent What I find works best is to use Insert | Picture | From File: Link to File to insert a "known-good" path in the IncludePicture field, then base my merge syntax on that. Also, if all the pictures are in a single folder, you can type the entire path except for the actual image filename as part of the field, putting just the image filename in the merge field. ================================= Here are my comments back to each person who provided help: To the first respondent: Thank You very much for your input. On the issue of typing the {}, that's exactly what I was attempting to do. At the time, I was kind of wondering about this, thinking it might be more like an array formula in Excel, but since Cindy didn't mention it on her web page... To the second respondent: Thank You Tony for your input. Actually, Access does have the Replace function available. I believe it was added in Access 2000. Prior to that, folks would code their own replace function, but I imagine that likely wouldn't work since the mail merge functionality is not running msaccess.exe to actually run such a function. One can call this function directly from a query, but only if Sandbox mode is not enabled for Access. ++++++++ However, since writing the above comment back to the second person, I have since discovered that Word Mail Merge does not want to display a SELECT query if it contains a reference to a built-in function, such as the Replace function. So, I ended up manually editing the paths in my database to include the double slashes separating the folders. Still no joy. Perhaps it would be a lot easier to just use Access as your report writer! Tom Wickerath Microsoft Access MVP https://mvp.support.microsoft.com/profile/Tom http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ "Renee B." wrote: I wasn't able to get it to work. I ended up getting the address with the coding instead of the picture. I added the path name to the DB as instructed and then went into Word to do the mail merge. The input was «AddressBlock» { IncludePicture "«PropertyPic»" } which resulted in Jane Doe 1234 5th St SUNRISE, FL 33322 { IncludePicture "xxxx SHADY GLEN DR.jpg" } Any suggestions? |
#3
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.access
|
|||
|
|||
Create Mail Merge List/Database in Access 2007
See http://www.gmayor.com/mail_merge_graphics.htm
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Tom Wickerath wrote: This reply to an existing thread in microsoft.public.access cross-posted to microsoft.public.word.mailmerge.fields. For those people in the mailmerge.fields group, who are seeing only this portion, the original thread can be found he http://www.microsoft.com/office/comm...4-57b8de2b8f8d ==================================== Hi Renee, I've spent hours trying, but so far I have not had any luck getting this to work correctly. I posted a request for help from other MVPs in Word and Access, and got three responses from Word MVPs. I've tried all of these responses, but still no joy. Here are the responses that I received: ================================= First respondent In this case, from what the OP posted, I would say that she has probably typed the {} around the INCLUDEPICTURE field, rather than using the special field braces you can insert using ctrl-F9. However, you also have to: a. either double up all the backslashes in the path name, or use forward slashes b. uncheck Word Tools-Options-General-Web options-Files-Update links on save - otherwise, when you save the mail merge main document, the included field is unlinked, leaving a URL-style path with %20s instead of spaces, and so on. c. select the output document and refresh all the INCLUDEPICTURE fields using F9. (You may find printing directly works, or you may have to set either or both of Word Tools-Options-Print-Update fields and Update links. My experience is that it is also very easy to insert a space that should not be there at the beginning of the file path name, e.g. using { INCLUDEPICTURE " { MERGEFIELD myfield }" } ================================= Second respondent I'm no expert with this stuff but the double backslashes are critical. AFAIK you can't do it in the merge itself (although you could probably manage it in a MailMergeAfterRecordMerge (or maybe MailMergeAfterMerge) Application event) and it would be better if you had a query in your database containing them, on which you could base the merge - unfortunately, again, I don't think this is as easy as it might be. You really need to use the VBA Replace(Photo,"\","\\") function but it doesn't exist as an Access function so you will need to build your own (rather trivial) VBA function and use that in your query. ================================= Third respondent What I find works best is to use Insert | Picture | From File: Link to File to insert a "known-good" path in the IncludePicture field, then base my merge syntax on that. Also, if all the pictures are in a single folder, you can type the entire path except for the actual image filename as part of the field, putting just the image filename in the merge field. ================================= Here are my comments back to each person who provided help: To the first respondent: Thank You very much for your input. On the issue of typing the {}, that's exactly what I was attempting to do. At the time, I was kind of wondering about this, thinking it might be more like an array formula in Excel, but since Cindy didn't mention it on her web page... To the second respondent: Thank You Tony for your input. Actually, Access does have the Replace function available. I believe it was added in Access 2000. Prior to that, folks would code their own replace function, but I imagine that likely wouldn't work since the mail merge functionality is not running msaccess.exe to actually run such a function. One can call this function directly from a query, but only if Sandbox mode is not enabled for Access. ++++++++ However, since writing the above comment back to the second person, I have since discovered that Word Mail Merge does not want to display a SELECT query if it contains a reference to a built-in function, such as the Replace function. So, I ended up manually editing the paths in my database to include the double slashes separating the folders. Still no joy. Perhaps it would be a lot easier to just use Access as your report writer! Tom Wickerath Microsoft Access MVP https://mvp.support.microsoft.com/profile/Tom http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ "Renee B." wrote: I wasn't able to get it to work. I ended up getting the address with the coding instead of the picture. I added the path name to the DB as instructed and then went into Word to do the mail merge. The input was «AddressBlock» { IncludePicture "«PropertyPic»" } which resulted in Jane Doe 1234 5th St SUNRISE, FL 33322 { IncludePicture "xxxx SHADY GLEN DR.jpg" } Any suggestions? |
#4
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.access
|
|||
|
|||
Create Mail Merge List/Database in Access 2007
1. I just tried it all again here with Word 2007/Access 2007. Certainly my
examples work as I suggested earlier. 2. You really need to be sure that the path is correct. To verify that, you can (rather obviously) a. merge to a new document b. use Alt-F9 to display one of the generated INCLUDEPICTURE fields, and see if the path is what you expect (it should have the backslashes doubled up at this point) 3. If you have stuff like UNC paths with double backslashes, you need to double them up too (i.e. in some case you need 4 backslashes). 4. The path typically needs to be a full path name. If not, do not expect Word to find the pictures in the same folder as the mail merge main document. It ctually looks in the "current" path which may not be that one. 5. It's possible that security issues are getting in the way, particularly if the image files are on a network. However, since writing the above comment back to the second person, I have since discovered that Word Mail Merge does not want to display a SELECT query if it contains a reference to a built-in function, such as the Replace function. This is not quite correct - Word Mail Merge can use /most/ of the built-in Access VBA functions in a query. However, unless the connection from Word uses the DDE protocol, which starts Access and sends the query for Access to execute, it cannot use a. some built-in functions (for example some of the financial series functions). In some (possibly all) cases this is because the functions are "in" Access but not "in" Jet (i.e., have not been added to all the internal structures they should have been added to) - I believe this is what has happened in the case of "replace". This is actually pretty irritating for MailMergers precisely for the reason you indicate. b. user-defined functions defined in Access VBA Perhaps it would be a lot easier to just use Access as your report writer! Undoubtedly the best option if a. feasible b. it gives you what you want. -- Peter Jamieson http://tips.pjmsn.me.uk "Tom Wickerath" AOS168b AT comcast DOT net wrote in message news This reply to an existing thread in microsoft.public.access cross-posted to microsoft.public.word.mailmerge.fields. For those people in the mailmerge.fields group, who are seeing only this portion, the original thread can be found he http://www.microsoft.com/office/comm...4-57b8de2b8f8d ==================================== Hi Renee, I've spent hours trying, but so far I have not had any luck getting this to work correctly. I posted a request for help from other MVPs in Word and Access, and got three responses from Word MVPs. I've tried all of these responses, but still no joy. Here are the responses that I received: ================================= First respondent In this case, from what the OP posted, I would say that she has probably typed the {} around the INCLUDEPICTURE field, rather than using the special field braces you can insert using ctrl-F9. However, you also have to: a. either double up all the backslashes in the path name, or use forward slashes b. uncheck Word Tools-Options-General-Web options-Files-Update links on save - otherwise, when you save the mail merge main document, the included field is unlinked, leaving a URL-style path with %20s instead of spaces, and so on. c. select the output document and refresh all the INCLUDEPICTURE fields using F9. (You may find printing directly works, or you may have to set either or both of Word Tools-Options-Print-Update fields and Update links. My experience is that it is also very easy to insert a space that should not be there at the beginning of the file path name, e.g. using { INCLUDEPICTURE " { MERGEFIELD myfield }" } ================================= Second respondent I'm no expert with this stuff but the double backslashes are critical. AFAIK you can't do it in the merge itself (although you could probably manage it in a MailMergeAfterRecordMerge (or maybe MailMergeAfterMerge) Application event) and it would be better if you had a query in your database containing them, on which you could base the merge - unfortunately, again, I don't think this is as easy as it might be. You really need to use the VBA Replace(Photo,"\","\\") function but it doesn't exist as an Access function so you will need to build your own (rather trivial) VBA function and use that in your query. ================================= Third respondent What I find works best is to use Insert | Picture | From File: Link to File to insert a "known-good" path in the IncludePicture field, then base my merge syntax on that. Also, if all the pictures are in a single folder, you can type the entire path except for the actual image filename as part of the field, putting just the image filename in the merge field. ================================= Here are my comments back to each person who provided help: To the first respondent: Thank You very much for your input. On the issue of typing the {}, that's exactly what I was attempting to do. At the time, I was kind of wondering about this, thinking it might be more like an array formula in Excel, but since Cindy didn't mention it on her web page... To the second respondent: Thank You Tony for your input. Actually, Access does have the Replace function available. I believe it was added in Access 2000. Prior to that, folks would code their own replace function, but I imagine that likely wouldn't work since the mail merge functionality is not running msaccess.exe to actually run such a function. One can call this function directly from a query, but only if Sandbox mode is not enabled for Access. ++++++++ However, since writing the above comment back to the second person, I have since discovered that Word Mail Merge does not want to display a SELECT query if it contains a reference to a built-in function, such as the Replace function. So, I ended up manually editing the paths in my database to include the double slashes separating the folders. Still no joy. Perhaps it would be a lot easier to just use Access as your report writer! Tom Wickerath Microsoft Access MVP https://mvp.support.microsoft.com/profile/Tom http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ "Renee B." wrote: I wasn't able to get it to work. I ended up getting the address with the coding instead of the picture. I added the path name to the DB as instructed and then went into Word to do the mail merge. The input was «AddressBlock» { IncludePicture "«PropertyPic»" } which resulted in Jane Doe 1234 5th St SUNRISE, FL 33322 { IncludePicture "xxxx SHADY GLEN DR.jpg" } Any suggestions? |
#5
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.access
|
|||
|
|||
Create Mail Merge List/Database in Access 2007
Doug,
Is there still an unanswered question here? Yes. Otherwise, I would not have written the following: "I've spent hours trying, but so far I have not had any luck getting this to work correctly." I will try the link that Graham provided next, although I won't have time to try it until after I return home from work, later today. Thanks Graham, in advance. Tom Wickerath Microsoft Access MVP https://mvp.support.microsoft.com/profile/Tom http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ "Doug Robbins - Word MVP" wrote: Is there still an unanswered question here? -- 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 |
#6
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.access
|
|||
|
|||
Create Mail Merge List/Database in Access 2007
Hi Peter,
I have not tried the sample with Word 2007 / Access 2007 (even though the title of this thread includes Access 2007). I've been trying to get this to work in earlier versions (Office 2002, SP-3 at first, followed by Office 2003, SP-2). 1. I just tried it all again here with Word 2007/Access 2007. Certainly my examples work as I suggested earlier. Can you get your example to work using Word 2003 with Access 2003? If so, is it possible for you to post a downloadable sample, with the images in a folder such as C:\Pics or C\Data\Pics, as in Cindy's original example? ______________________ 2. You really need to be sure that the path is correct. I am absolutely sure that the paths I am using, including the filenames, are correct. b. use Alt-F9 to display one of the generated INCLUDEPICTURE fields, ... Earlier, you indicated: "c. select the output document and refresh all the INCLUDEPICTURE fields using F9." I couldn't tell that F9 was doing anything. Now, I wonder if you meant Alt-F9 the first time? (it should have the backslashes doubled up at this point) The paths included doubled-up backslashes. I even tried changing the paths stored in my Access app. to include the doubled-up backslashes, so that I could call a query directly, without having to attempt to use the Replace function within the query, which Word was objecting to without invoking DDE. I entered the following: { IncludePicture "{ MergeField Photo }" } making sure to use Ctrl F9 to enter the curly braces. When I right-click on Toggle Field Codes, I see the following: { IncludePicture "C:\\Pics\\HPIM0783.JPG" } I did not enter this path, but it is correct, so apparently Word successfully replaced the "{ MergeField Photo }" with the actual path. The next record initially displays: C:\\Pics\\HPIM0781.JPG (not correct). However, when I right-click on this merge field, and select "Toggle Field Codes", I now see: { IncludePicture "C:\\Pics\\HPIM0777.JPG" } which is correct. Again, I never entered the path "C:\\Pics\\HPIM0777.JPG" directly in Word. Clicking on the third record, once again I see: C:\\Pics\\HPIM0781.JPG (incorrect). and when I right-click on the merge field and select Toggle Field codes, I see the correct path: { IncludePicture "C:\\Pics\\HPIM0781.JPG" } The best I can seem to achieve was an address block that changed with each record, as expected, but the picture was the same for all records, as though it was simply inserted but not via a merge. I have also tried: { IncludePicture { MergeField "Photo" } } and { IncludePicture "{ MergeField "Photo" }" } to no avail. ______________________ 3. If you have stuff like UNC paths... No UNC paths at this point. Also, nothing difficult in the path I am using. The three test paths for the images all conform to the old DOS 8.3 pattern, without any spaces or special characters. ______________________ 4. The path typically needs to be a full path name. If not, do not expect Word to find the pictures in the same folder as the mail merge main document. It ctually looks in the "current" path which may not be that one. The paths are full names in each case. My test Word document is located on a separate physical hard drive, as "G:\ImageDemo\MergeTest.doc". ______________________ 5. It's possible that security issues are getting in the way, particularly if the image files are on a network. There is no network involved. I am the admin. on this PC. I'm still using Windows 2000 Server as my operating system. Hopefully that does not matter. The Access application is also located in G:\ImageDemo\ImageDemo.mdb. A form in this Access application, which includes an image control, correctly displays the three test images, even after I doubled up the backslashes. Tom Wickerath Microsoft Access MVP https://mvp.support.microsoft.com/profile/Tom http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ "Peter Jamieson" wrote: 1. I just tried it all again here with Word 2007/Access 2007. Certainly my examples work as I suggested earlier. 2. You really need to be sure that the path is correct. To verify that, you can (rather obviously) a. merge to a new document b. use Alt-F9 to display one of the generated INCLUDEPICTURE fields, and see if the path is what you expect (it should have the backslashes doubled up at this point) 3. If you have stuff like UNC paths with double backslashes, you need to double them up too (i.e. in some case you need 4 backslashes). 4. The path typically needs to be a full path name. If not, do not expect Word to find the pictures in the same folder as the mail merge main document. It ctually looks in the "current" path which may not be that one. 5. It's possible that security issues are getting in the way, particularly if the image files are on a network. However, since writing the above comment back to the second person, I have since discovered that Word Mail Merge does not want to display a SELECT query if it contains a reference to a built-in function, such as the Replace function. This is not quite correct - Word Mail Merge can use /most/ of the built-in Access VBA functions in a query. However, unless the connection from Word uses the DDE protocol, which starts Access and sends the query for Access to execute, it cannot use a. some built-in functions (for example some of the financial series functions). In some (possibly all) cases this is because the functions are "in" Access but not "in" Jet (i.e., have not been added to all the internal structures they should have been added to) - I believe this is what has happened in the case of "replace". This is actually pretty irritating for MailMergers precisely for the reason you indicate. b. user-defined functions defined in Access VBA Perhaps it would be a lot easier to just use Access as your report writer! Undoubtedly the best option if a. feasible b. it gives you what you want. -- Peter Jamieson http://tips.pjmsn.me.uk "Tom Wickerath" AOS168b AT comcast DOT net wrote in message news This reply to an existing thread in microsoft.public.access cross-posted to microsoft.public.word.mailmerge.fields. For those people in the mailmerge.fields group, who are seeing only this portion, the original thread can be found he http://www.microsoft.com/office/comm...4-57b8de2b8f8d ==================================== Hi Renee, I've spent hours trying, but so far I have not had any luck getting this to work correctly. I posted a request for help from other MVPs in Word and Access, and got three responses from Word MVPs. I've tried all of these responses, but still no joy. Here are the responses that I received: ================================= First respondent In this case, from what the OP posted, I would say that she has probably typed the {} around the INCLUDEPICTURE field, rather than using the special field braces you can insert using ctrl-F9. However, you also have to: a. either double up all the backslashes in the path name, or use forward slashes b. uncheck Word Tools-Options-General-Web options-Files-Update links on save - otherwise, when you save the mail merge main document, the included field is unlinked, leaving a URL-style path with %20s instead of spaces, and so on. c. select the output document and refresh all the INCLUDEPICTURE fields using F9. (You may find printing directly works, or you may have to set either or both of Word Tools-Options-Print-Update fields and Update links. My experience is that it is also very easy to insert a space that should not be there at the beginning of the file path name, e.g. using { INCLUDEPICTURE " { MERGEFIELD myfield }" } ================================= Second respondent I'm no expert with this stuff but the double backslashes are critical. AFAIK you can't do it in the merge itself (although you could probably manage it in a MailMergeAfterRecordMerge (or maybe MailMergeAfterMerge) Application event) and it would be better if you had a query in your database containing them, on which you could base the merge - unfortunately, again, I don't think this is as easy as it might be. You really need to use the VBA Replace(Photo,"\","\\") function but it doesn't exist as an Access function so you will need to build your own (rather trivial) VBA function and use that in your query. ================================= Third respondent What I find works best is to use Insert | Picture | From File: Link to File to insert a "known-good" path in the IncludePicture field, then base my merge syntax on that. Also, if all the pictures are in a single folder, you can type the entire path except for the actual image filename as part of the field, putting just the image filename in the merge field. ================================= Here are my comments back to each person who provided help: To the first respondent: Thank You very much for your input. On the issue of typing the {}, that's exactly what I was attempting to do. At the time, I was kind of wondering about this, thinking it might be more like an array formula in Excel, but since Cindy didn't mention it on her web page... To the second respondent: Thank You Tony for your input. Actually, Access does have the Replace function available. I believe it was added in Access 2000. Prior to that, folks would code their own replace function, but I imagine that likely wouldn't work since the mail merge functionality is not running msaccess.exe to actually run such a function. One can call this function directly from a query, but only if Sandbox mode is not enabled for Access. ++++++++ However, since writing the above comment back to the second person, I have since discovered that Word Mail Merge does not want to display a SELECT query if it contains a reference to a built-in function, such as the Replace function. So, I ended up manually editing the paths in my database to include the double slashes separating the folders. Still no joy. Perhaps it would be a lot easier to just use Access as your report writer! Tom Wickerath Microsoft Access MVP https://mvp.support.microsoft.com/profile/Tom http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ "Renee B." wrote: I wasn't able to get it to work. I ended up getting the address with the coding instead of the picture. I added the path name to the DB as instructed and then went into Word to do the mail merge. The input was «AddressBlock» { IncludePicture "«PropertyPic»" } which resulted in Jane Doe 1234 5th St SUNRISE, FL 33322 { IncludePicture "xxxx SHADY GLEN DR.jpg" } Any suggestions? |
#7
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.access
|
|||
|
|||
Create Mail Merge List/Database in Access 2007
Hi Tom,
Funnily enough, it was the Access/Word combination I was unsure of - the technique was well-established before that. Can you get your example to work using Word 2003 with Access 2003? If so, is it possible for you to post a downloadable sample, with the images in a folder such as C:\Pics or C\Data\Pics, as in Cindy's original example? For a short time only, 1. see if you can download http://tips.pjmsn.me.uk/downloads/pjjtest1.zip (it's about 370Kb) 2. It expects to be unpacked to c:\pjjtest1 (there should be folders c:\pjjtest1\database, c:\pjjtest1\documents, c:\pjjtest1\images. If you unpack elsewhere (and even if you don't) you may have to reconnect to the data source. 3. the database folder contains testdb.mdb with a single table containing some very simple records with doubled-up backslash pathnames to the images folder 4. the documents folder contains a. the_images.doc, with the images inserted using ordinary INCLUDEPICTURE fields b. mmmd.doc, a Mail Merge Main Document with the kind of stuff we've been discussing c. results.doc, the results immediately after a merge to a new document d. results_after_select_and_update_fields.doc (self-explanatory name I hope...) This sample was made using Office 2003 SP3 (11.8166.8172) on Win XP Pro SP2. On your points.. I couldn't tell that F9 was doing anything. Now, I wonder if you meant Alt-F9 the first time? No, Select everything and F9 was intended to update the fields. Alt-F9 was intended for inspecting the field codes. { IncludePicture "{ MergeField Photo }" } making sure to use Ctrl F9 to enter the curly braces. When I right-click on Toggle Field Codes, I see the following: { IncludePicture "C:\\Pics\\HPIM0783.JPG" } I did not enter this path, but it is correct, so apparently Word successfully replaced the "{ MergeField Photo }" with the actual path. The next record initially displays: C:\\Pics\\HPIM0781.JPG (not correct). However, when I right-click on this merge field, and select "Toggle Field Codes", I now see: { IncludePicture "C:\\Pics\\HPIM0777.JPG" } This is the behaviour I would expect. The best I can seem to achieve was an address block that changed with each record, as expected, but the picture was the same for all records, as though it was simply inserted but not via a merge. It is the same until you refresh the fields. However, since it doesn't seem to be doing that for you, maybe you have F9 set to something other than "refresh field codes"? Another thing that may affect this behaviour is the FieldCalcSecurityLevel registry setting which is described at http://support.microsoft.com/kb/330079/en-us I'm not conscious of having to change it for Word 2003 for this to work but people with Word 2002 installations may well have to mess around with this. -- Peter Jamieson http://tips.pjmsn.me.uk "Tom Wickerath" AOS168b AT comcast DOT net wrote in message ... Hi Peter, I have not tried the sample with Word 2007 / Access 2007 (even though the title of this thread includes Access 2007). I've been trying to get this to work in earlier versions (Office 2002, SP-3 at first, followed by Office 2003, SP-2). 1. I just tried it all again here with Word 2007/Access 2007. Certainly my examples work as I suggested earlier. Can you get your example to work using Word 2003 with Access 2003? If so, is it possible for you to post a downloadable sample, with the images in a folder such as C:\Pics or C\Data\Pics, as in Cindy's original example? ______________________ 2. You really need to be sure that the path is correct. I am absolutely sure that the paths I am using, including the filenames, are correct. b. use Alt-F9 to display one of the generated INCLUDEPICTURE fields, ... Earlier, you indicated: "c. select the output document and refresh all the INCLUDEPICTURE fields using F9." I couldn't tell that F9 was doing anything. Now, I wonder if you meant Alt-F9 the first time? (it should have the backslashes doubled up at this point) The paths included doubled-up backslashes. I even tried changing the paths stored in my Access app. to include the doubled-up backslashes, so that I could call a query directly, without having to attempt to use the Replace function within the query, which Word was objecting to without invoking DDE. I entered the following: { IncludePicture "{ MergeField Photo }" } making sure to use Ctrl F9 to enter the curly braces. When I right-click on Toggle Field Codes, I see the following: { IncludePicture "C:\\Pics\\HPIM0783.JPG" } I did not enter this path, but it is correct, so apparently Word successfully replaced the "{ MergeField Photo }" with the actual path. The next record initially displays: C:\\Pics\\HPIM0781.JPG (not correct). However, when I right-click on this merge field, and select "Toggle Field Codes", I now see: { IncludePicture "C:\\Pics\\HPIM0777.JPG" } which is correct. Again, I never entered the path "C:\\Pics\\HPIM0777.JPG" directly in Word. Clicking on the third record, once again I see: C:\\Pics\\HPIM0781.JPG (incorrect). and when I right-click on the merge field and select Toggle Field codes, I see the correct path: { IncludePicture "C:\\Pics\\HPIM0781.JPG" } The best I can seem to achieve was an address block that changed with each record, as expected, but the picture was the same for all records, as though it was simply inserted but not via a merge. I have also tried: { IncludePicture { MergeField "Photo" } } and { IncludePicture "{ MergeField "Photo" }" } to no avail. ______________________ 3. If you have stuff like UNC paths... No UNC paths at this point. Also, nothing difficult in the path I am using. The three test paths for the images all conform to the old DOS 8.3 pattern, without any spaces or special characters. ______________________ 4. The path typically needs to be a full path name. If not, do not expect Word to find the pictures in the same folder as the mail merge main document. It ctually looks in the "current" path which may not be that one. The paths are full names in each case. My test Word document is located on a separate physical hard drive, as "G:\ImageDemo\MergeTest.doc". ______________________ 5. It's possible that security issues are getting in the way, particularly if the image files are on a network. There is no network involved. I am the admin. on this PC. I'm still using Windows 2000 Server as my operating system. Hopefully that does not matter. The Access application is also located in G:\ImageDemo\ImageDemo.mdb. A form in this Access application, which includes an image control, correctly displays the three test images, even after I doubled up the backslashes. Tom Wickerath Microsoft Access MVP https://mvp.support.microsoft.com/profile/Tom http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ "Peter Jamieson" wrote: 1. I just tried it all again here with Word 2007/Access 2007. Certainly my examples work as I suggested earlier. 2. You really need to be sure that the path is correct. To verify that, you can (rather obviously) a. merge to a new document b. use Alt-F9 to display one of the generated INCLUDEPICTURE fields, and see if the path is what you expect (it should have the backslashes doubled up at this point) 3. If you have stuff like UNC paths with double backslashes, you need to double them up too (i.e. in some case you need 4 backslashes). 4. The path typically needs to be a full path name. If not, do not expect Word to find the pictures in the same folder as the mail merge main document. It ctually looks in the "current" path which may not be that one. 5. It's possible that security issues are getting in the way, particularly if the image files are on a network. However, since writing the above comment back to the second person, I have since discovered that Word Mail Merge does not want to display a SELECT query if it contains a reference to a built-in function, such as the Replace function. This is not quite correct - Word Mail Merge can use /most/ of the built-in Access VBA functions in a query. However, unless the connection from Word uses the DDE protocol, which starts Access and sends the query for Access to execute, it cannot use a. some built-in functions (for example some of the financial series functions). In some (possibly all) cases this is because the functions are "in" Access but not "in" Jet (i.e., have not been added to all the internal structures they should have been added to) - I believe this is what has happened in the case of "replace". This is actually pretty irritating for MailMergers precisely for the reason you indicate. b. user-defined functions defined in Access VBA Perhaps it would be a lot easier to just use Access as your report writer! Undoubtedly the best option if a. feasible b. it gives you what you want. -- Peter Jamieson http://tips.pjmsn.me.uk "Tom Wickerath" AOS168b AT comcast DOT net wrote in message news This reply to an existing thread in microsoft.public.access cross-posted to microsoft.public.word.mailmerge.fields. For those people in the mailmerge.fields group, who are seeing only this portion, the original thread can be found he http://www.microsoft.com/office/comm...4-57b8de2b8f8d ==================================== Hi Renee, I've spent hours trying, but so far I have not had any luck getting this to work correctly. I posted a request for help from other MVPs in Word and Access, and got three responses from Word MVPs. I've tried all of these responses, but still no joy. Here are the responses that I received: ================================= First respondent In this case, from what the OP posted, I would say that she has probably typed the {} around the INCLUDEPICTURE field, rather than using the special field braces you can insert using ctrl-F9. However, you also have to: a. either double up all the backslashes in the path name, or use forward slashes b. uncheck Word Tools-Options-General-Web options-Files-Update links on save - otherwise, when you save the mail merge main document, the included field is unlinked, leaving a URL-style path with %20s instead of spaces, and so on. c. select the output document and refresh all the INCLUDEPICTURE fields using F9. (You may find printing directly works, or you may have to set either or both of Word Tools-Options-Print-Update fields and Update links. My experience is that it is also very easy to insert a space that should not be there at the beginning of the file path name, e.g. using { INCLUDEPICTURE " { MERGEFIELD myfield }" } ================================= Second respondent I'm no expert with this stuff but the double backslashes are critical. AFAIK you can't do it in the merge itself (although you could probably manage it in a MailMergeAfterRecordMerge (or maybe MailMergeAfterMerge) Application event) and it would be better if you had a query in your database containing them, on which you could base the merge - unfortunately, again, I don't think this is as easy as it might be. You really need to use the VBA Replace(Photo,"\","\\") function but it doesn't exist as an Access function so you will need to build your own (rather trivial) VBA function and use that in your query. ================================= Third respondent What I find works best is to use Insert | Picture | From File: Link to File to insert a "known-good" path in the IncludePicture field, then base my merge syntax on that. Also, if all the pictures are in a single folder, you can type the entire path except for the actual image filename as part of the field, putting just the image filename in the merge field. ================================= Here are my comments back to each person who provided help: To the first respondent: Thank You very much for your input. On the issue of typing the {}, that's exactly what I was attempting to do. At the time, I was kind of wondering about this, thinking it might be more like an array formula in Excel, but since Cindy didn't mention it on her web page... To the second respondent: Thank You Tony for your input. Actually, Access does have the Replace function available. I believe it was added in Access 2000. Prior to that, folks would code their own replace function, but I imagine that likely wouldn't work since the mail merge functionality is not running msaccess.exe to actually run such a function. One can call this function directly from a query, but only if Sandbox mode is not enabled for Access. ++++++++ However, since writing the above comment back to the second person, I have since discovered that Word Mail Merge does not want to display a SELECT query if it contains a reference to a built-in function, such as the Replace function. So, I ended up manually editing the paths in my database to include the double slashes separating the folders. Still no joy. Perhaps it would be a lot easier to just use Access as your report writer! Tom Wickerath Microsoft Access MVP https://mvp.support.microsoft.com/profile/Tom http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ "Renee B." wrote: I wasn't able to get it to work. I ended up getting the address with the coding instead of the picture. I added the path name to the DB as instructed and then went into Word to do the mail merge. The input was «AddressBlock» { IncludePicture "«PropertyPic»" } which resulted in Jane Doe 1234 5th St SUNRISE, FL 33322 { IncludePicture "xxxx SHADY GLEN DR.jpg" } Any suggestions? |
#8
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.access
|
|||
|
|||
Create Mail Merge List/Database in Access 2007
Hi Peter,
Thank You for posting your sample. I stayed late at work, and spent some time looking at your sample. I need to do the same on my PC at home. I'll have more to write within the next few days, but I've simply run out of time now. Perhaps it would be best if I took further discussion off-line, to the private newsgroup, and then posted a summary here, afterwards. I couldn't tell that F9 was doing anything. Now, I wonder if you meant Alt-F9 the first time? No, Select everything and F9 was intended to update the fields. I think I may have been failing to select everything first. I was just trying to push the F9 button. It is the same until you refresh the fields. However, since it doesn't seem to be doing that for you, maybe you have F9 set to something other than "refresh field codes"? I have not done any remapping of any keys in Word. I only know how to do the most basic stuff in Word. I'm a lot more comfortable as an Access Developer, vs. any kind of Word guru. Tom Wickerath Microsoft Access MVP https://mvp.support.microsoft.com/profile/Tom http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ "Peter Jamieson" wrote: Hi Tom, Funnily enough, it was the Access/Word combination I was unsure of - the technique was well-established before that. Can you get your example to work using Word 2003 with Access 2003? If so, is it possible for you to post a downloadable sample, with the images in a folder such as C:\Pics or C\Data\Pics, as in Cindy's original example? For a short time only, 1. see if you can download http://tips.pjmsn.me.uk/downloads/pjjtest1.zip (it's about 370Kb) 2. It expects to be unpacked to c:\pjjtest1 (there should be folders c:\pjjtest1\database, c:\pjjtest1\documents, c:\pjjtest1\images. If you unpack elsewhere (and even if you don't) you may have to reconnect to the data source. 3. the database folder contains testdb.mdb with a single table containing some very simple records with doubled-up backslash pathnames to the images folder 4. the documents folder contains a. the_images.doc, with the images inserted using ordinary INCLUDEPICTURE fields b. mmmd.doc, a Mail Merge Main Document with the kind of stuff we've been discussing c. results.doc, the results immediately after a merge to a new document d. results_after_select_and_update_fields.doc (self-explanatory name I hope...) This sample was made using Office 2003 SP3 (11.8166.8172) on Win XP Pro SP2. On your points.. I couldn't tell that F9 was doing anything. Now, I wonder if you meant Alt-F9 the first time? No, Select everything and F9 was intended to update the fields. Alt-F9 was intended for inspecting the field codes. { IncludePicture "{ MergeField Photo }" } making sure to use Ctrl F9 to enter the curly braces. When I right-click on Toggle Field Codes, I see the following: { IncludePicture "C:\\Pics\\HPIM0783.JPG" } I did not enter this path, but it is correct, so apparently Word successfully replaced the "{ MergeField Photo }" with the actual path. The next record initially displays: C:\\Pics\\HPIM0781.JPG (not correct). However, when I right-click on this merge field, and select "Toggle Field Codes", I now see: { IncludePicture "C:\\Pics\\HPIM0777.JPG" } This is the behaviour I would expect. The best I can seem to achieve was an address block that changed with each record, as expected, but the picture was the same for all records, as though it was simply inserted but not via a merge. It is the same until you refresh the fields. However, since it doesn't seem to be doing that for you, maybe you have F9 set to something other than "refresh field codes"? Another thing that may affect this behaviour is the FieldCalcSecurityLevel registry setting which is described at http://support.microsoft.com/kb/330079/en-us I'm not conscious of having to change it for Word 2003 for this to work but people with Word 2002 installations may well have to mess around with this. -- Peter Jamieson http://tips.pjmsn.me.uk |
#9
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.access
|
|||
|
|||
Create Mail Merge List/Database in Access 2007
Perhaps it would be best if I took further discussion off-line, to the private newsgroup, and then posted a summary here, afterwards. Whichever you like! FWIW the problem with trying to do many mailmerges is that /so many/ conditions have to be right before they will function properly. If you're doing the merges for yourself, it's not that hard to get it right, but if you're trying to distribute an automated solution, you end up having to consider fixing the user's registry, fixing their Word options, putting macro code in to update the output document, and therefore ensuring that the user's security settings let them run that code, and so on. -- Peter Jamieson http://tips.pjmsn.me.uk "Tom Wickerath" AOS168b AT comcast DOT net wrote in message ... Hi Peter, Thank You for posting your sample. I stayed late at work, and spent some time looking at your sample. I need to do the same on my PC at home. I'll have more to write within the next few days, but I've simply run out of time now. Perhaps it would be best if I took further discussion off-line, to the private newsgroup, and then posted a summary here, afterwards. I couldn't tell that F9 was doing anything. Now, I wonder if you meant Alt-F9 the first time? No, Select everything and F9 was intended to update the fields. I think I may have been failing to select everything first. I was just trying to push the F9 button. It is the same until you refresh the fields. However, since it doesn't seem to be doing that for you, maybe you have F9 set to something other than "refresh field codes"? I have not done any remapping of any keys in Word. I only know how to do the most basic stuff in Word. I'm a lot more comfortable as an Access Developer, vs. any kind of Word guru. Tom Wickerath Microsoft Access MVP https://mvp.support.microsoft.com/profile/Tom http://www.access.qbuilt.com/html/ex...tributors.html __________________________________________ "Peter Jamieson" wrote: Hi Tom, Funnily enough, it was the Access/Word combination I was unsure of - the technique was well-established before that. Can you get your example to work using Word 2003 with Access 2003? If so, is it possible for you to post a downloadable sample, with the images in a folder such as C:\Pics or C\Data\Pics, as in Cindy's original example? For a short time only, 1. see if you can download http://tips.pjmsn.me.uk/downloads/pjjtest1.zip (it's about 370Kb) 2. It expects to be unpacked to c:\pjjtest1 (there should be folders c:\pjjtest1\database, c:\pjjtest1\documents, c:\pjjtest1\images. If you unpack elsewhere (and even if you don't) you may have to reconnect to the data source. 3. the database folder contains testdb.mdb with a single table containing some very simple records with doubled-up backslash pathnames to the images folder 4. the documents folder contains a. the_images.doc, with the images inserted using ordinary INCLUDEPICTURE fields b. mmmd.doc, a Mail Merge Main Document with the kind of stuff we've been discussing c. results.doc, the results immediately after a merge to a new document d. results_after_select_and_update_fields.doc (self-explanatory name I hope...) This sample was made using Office 2003 SP3 (11.8166.8172) on Win XP Pro SP2. On your points.. I couldn't tell that F9 was doing anything. Now, I wonder if you meant Alt-F9 the first time? No, Select everything and F9 was intended to update the fields. Alt-F9 was intended for inspecting the field codes. { IncludePicture "{ MergeField Photo }" } making sure to use Ctrl F9 to enter the curly braces. When I right-click on Toggle Field Codes, I see the following: { IncludePicture "C:\\Pics\\HPIM0783.JPG" } I did not enter this path, but it is correct, so apparently Word successfully replaced the "{ MergeField Photo }" with the actual path. The next record initially displays: C:\\Pics\\HPIM0781.JPG (not correct). However, when I right-click on this merge field, and select "Toggle Field Codes", I now see: { IncludePicture "C:\\Pics\\HPIM0777.JPG" } This is the behaviour I would expect. The best I can seem to achieve was an address block that changed with each record, as expected, but the picture was the same for all records, as though it was simply inserted but not via a merge. It is the same until you refresh the fields. However, since it doesn't seem to be doing that for you, maybe you have F9 set to something other than "refresh field codes"? Another thing that may affect this behaviour is the FieldCalcSecurityLevel registry setting which is described at http://support.microsoft.com/kb/330079/en-us I'm not conscious of having to change it for Word 2003 for this to work but people with Word 2002 installations may well have to mess around with this. -- Peter Jamieson http://tips.pjmsn.me.uk |
#10
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.access
|
|||
|
|||
Create Mail Merge List/Database in Access 2007
Tom Wickerath wrote:
It is the same until you refresh the fields. However, since it doesn't seem to be doing that for you, maybe you have F9 set to something other than "refresh field codes"? I have not done any remapping of any keys in Word. I only know how to do the most basic stuff in Word. I'm a lot more comfortable as an Access Developer, vs. any kind of Word guru. If you have a keyboard with dual functions on the fKeys, you may need to toggle the function with an FLock key? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I access a database in Outlook Express for mail merge | Mailmerge | |||
Mail Merge from an Access Database table | Mailmerge | |||
have address list in Word doc, need to create a database for merge | Mailmerge | |||
want a list to appear in merge doc from access database | Mailmerge | |||
Mail Merge to a secured Access database | Mailmerge |