Working with MS Word and MS Access 
Author Message
 Working with MS Word and MS Access

PLEASE READ THIS. I COULD REALLY USE THE HELP...

I want to use automation to do a mass mail form within MS Access, using
and MS Word document. Microsoft's KB Article: Q131583 - ACC: Sending the
Current Record to Word 97 with Automation is good, but not great. It has
one unfortunate quirk to it. Say you want to place the firstname from
the current record in the document in more than one spot, you have to
create bookmarks for each of those spots and make sure your code
includes all of those bookmarks. This can be bad since certain documents
will contain X amount of firstname bookmarks, and other documents will
contain a different number. You can use error checking to make sure
error messages don't appear for the missing bookmarks, but you still
have to make sure your code contains the maximum number of firstname
bookmarks within all of your documents. This can be not only very
inefficient, but it is also a lot of code. I am looking for the easiest
way to not just program the automation, but more importantly, for the
user to create new documents and make them code-ready (in other words,
make them ready for the exisitng Access code to import records into it).
I came up with the idea of having the user type in stuff like:
{Firstname}, {Lastname}, etc., wherever the user wants to import this
info, and then from Access code, do a find a replace in the Word
document, however this too has a problem. If you are doing a mass mail,
this will not work after the first find/replace cycle (since these
"field-like" texts no longer exist"). The only way to use this
find/replace idea, is after you do the find/replace cycle and print the
document, you either close it and re-open it (making sure not to save
changes on closure), or you do an undo all. The close then re-open
method is also inefficient. As far as the undo method goes, I have no
idea how to do an undo all from within Access on the current MS Word
object document. Anyone know? Does anyone have any other ideas for doing
automation? Appreciate any help anyone can offer. Thank you for taking
the time to read this.

Chad Waldman



Thu, 25 Jan 2001 03:00:00 GMT  
 Working with MS Word and MS Access

Quote:

> ...
> I want to use automation to do a mass mail form within MS Access, using
> and MS Word document. Microsoft's KB Article: Q131583 - ACC: Sending the
> Current Record to Word 97 with Automation is good, but not great. It has
> one unfortunate quirk to it. Say you want to place the firstname from
> the current record in the document in more than one spot, you have to
> create bookmarks for each of those spots and make sure your code
> includes all of those bookmarks. This can be bad since certain documents
> will contain X amount of firstname bookmarks, and other documents will
> contain a different number.
> ...
> Chad Waldman


Might try one bookmark for the {firstname} etc., then use a
cross-reference field {REF xxx} for the repetitions. Then use the OLE to
replace the first bookmark and then force an update fields (if needed)
when all your bookmarks are replaced.

--
Bruce H. Johnson
Corporate Knowledge, Inc. Los Angeles, California

#include <std_disclaimer>



Fri, 26 Jan 2001 03:00:00 GMT  
 Working with MS Word and MS Access
The Litwin/Get Access book has a good example how to do this.
Create bookmarks that match you form field names. For each bookmark after
the first, add 1, ie.  name, name1, name2, etc. Then you write code that
loops looking for bookmarks name, name+1, name+2, and exits when it can't
find any more. The book example moves data from a form to word. I have
modified it successfully to go right from a table record to word.

Quote:
>PLEASE READ THIS. I COULD REALLY USE THE HELP...

>I want to use automation to do a mass mail form within MS Access, using
>and MS Word document. Microsoft's KB Article: Q131583 - ACC: Sending the
>Current Record to Word 97 with Automation is good, but not great. It has
>one unfortunate quirk to it. Say you want to place the firstname from
>the current record in the document in more than one spot, you have to
>create bookmarks for each of those spots and make sure your code
>includes all of those bookmarks. This can be bad since certain documents
>will contain X amount of firstname bookmarks, and other documents will
>contain a different number. You can use error checking to make sure
>error messages don't appear for the missing bookmarks, but you still
>have to make sure your code contains the maximum number of firstname
>bookmarks within all of your documents. This can be not only very
>inefficient, but it is also a lot of code. I am looking for the easiest
>way to not just program the automation, but more importantly, for the
>user to create new documents and make them code-ready (in other words,
>make them ready for the exisitng Access code to import records into it).
>I came up with the idea of having the user type in stuff like:
>{Firstname}, {Lastname}, etc., wherever the user wants to import this
>info, and then from Access code, do a find a replace in the Word
>document, however this too has a problem. If you are doing a mass mail,
>this will not work after the first find/replace cycle (since these
>"field-like" texts no longer exist"). The only way to use this
>find/replace idea, is after you do the find/replace cycle and print the
>document, you either close it and re-open it (making sure not to save
>changes on closure), or you do an undo all. The close then re-open
>method is also inefficient. As far as the undo method goes, I have no
>idea how to do an undo all from within Access on the current MS Word
>object document. Anyone know? Does anyone have any other ideas for doing
>automation? Appreciate any help anyone can offer. Thank you for taking
>the time to read this.

>Chad Waldman




Wed, 31 Jan 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Accessing current record in MS Access with DDE from MS Word

2. How does one look at data in an open MS access aplication from MS Word

3. MS Access & MS Word Automation/Security Issue

4. Lookup MS Access table from MS Word

5. How does one look at data in an open MS access aplication from MS Word

6. mail-merge MS Word and MS Access via ASP

7. Q:Envoking MS-Word from VB4 when Exchange is using MS-Word

8. Regarding Accessing External database using MS-Access and MS-Visual Basic

9. Link MS Access on PocketPC to Desktop MS Access

10. MS PJ 2000 and MS Word via VBA

11. MS Word VBA with MS Graph

12. MS Word to grab data from MS IExplorer (5.5)

 

 
Powered by phpBB® Forum Software