[AccessD] Word Automation

Klos, Susan Susan.Klos at fldoe.org
Wed Mar 12 07:18:01 CST 2003


Henry, I would like to learn more about how you do this.  I have a new
client who is doing a merge currently from Excel.  His Master word document
is set up with a bunch of field codes.  He does a mail merge from excel and
has a bunch of if statements in the master document that put different
responses in depending on the information in the excel field.  He know he
needs to store the data in Access and we have had a session (he wants to
learn Access at the same time we are doing this) where he learned how to
create tables, set primary keys and relationships.  There are 4 or 5 tables
at present, but there is no table set up that would hold the responses yet.
He is comfortable with the way he has set up his word document and I am not
sure how to show him that storing everything in Access would be better than
doing it the way he is currently.  My gut feeling is that it would be.  I
will try to give you an example of what he has in his word document.

<p> blah blah blah {IF{MERGEFIELED whatever}="a" "Some text goes here"}blah
blah blah.  He might have several of these if statements depending on what
is in the field.  ie a=some text b=some other text c=some other text
altogether  The field from the database might also trigger a document that
is on the network that gets merged into the master doc at some point.  

The master doc is an RFP / Contract.  The RFP gets filled in first then the
contract gets filled in. 

I guess what I am asking is 1)should the text be held in the database rather
than the codes that trigger the if statements in the word doc. 2)would just
inserting merge fields into the doc work or should bookmarks be used?  Why
would bookmarks be better if they are?  

Maybe you could recommend a book that would be good background on this sort
of thing. 

-----Original Message-----
From: Henry Simpson [mailto:hsimpson88 at hotmail.com]
Sent: Tuesday, March 11, 2003 4:47 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Word Automation


If you invest a significant amount of work in Word, you will find that an 
Automation session of Word run by Access can iterate the bookmarks 
collection of the document object.  I have given the users a list of 
bookmark names that they can use in any document.  If they save that 
document as a template in a particular folder, that template file will 
appear in a callback filled combo of documents that may be created from a 
record or query.  Double click of any template file in the combo will create

a new Word doc based on the template for the record or each record in a 
query should that source be selected.

For versatility with things like date datatypes, users have been trained to 
use a bookmark named DocDate for 'March 11, 2003' or DocDate_dd_mmm for '11 
Mar'.  Since bookmarks can not contain punctuation, should punctuation be 
required, the Date must be broken down into components with the punctuation 
between bookmarks.  If the suffix of any bookmark containing a parsable 
format string ends in 'ord' and begins with 'DocDate', then the appropriate 
th, rd or nd suffix is appended in Word.  Should the document require the 
current month or the month of a project start date or an invoice date or 
whatever, in several places, the bookmark name cannot be repeated.  In that 
case, the users Prefix the bookmark with DocDate1, DocDate2 and so on.

For things like this, all that happens is that the application iterates and 
parses each bookmark name and selects the appropriate field and format to 
write to Word.  Should the field parsed data type happen to be currency, a 
formatCurrency function is called that formats the data to a currency 
string.

Users may now point any query at any document in their custom templates 
folder and Access will generate a series of documents.  What's more, the 
users need only be able to set parameters from a multi field filter 
interface and not only is the query customized accordingly, related records 
are pulled even though they may not be required by the document.  The price 
of flexibility is a bit of overhead in the queries as a Project record may 
have related invoice data when all that is needed is PO information.

Not one of the users I deal with knows how to generate a merge, never mind a

query, but they can select a record from a combo and punch a button.  And 
now, they can even use the insert menu from Word and insert one of about 200

allowed bookmark names.  They have even figured out how to save the file in 
their custom template folder.  The biggest training hurdle was to get them 
to add a suffix to a field name of the bookmark should it be required in 
more than one place in the document.

Although considerable effort and thought went into the original system, it 
is now virtually maintenance free and I am rarely called in for minor 
changes to existing document templates or even entirely new documents.


Hen

>From: Brett Barabash <BBarabash at tappeconstruction.com>
>Reply-To: accessd at databaseadvisors.com
>To: "'accessd at databaseadvisors.com'" <accessd at databaseadvisors.com>
>Subject: RE: [AccessD] Word Automation
>Date: Tue, 11 Mar 2003 14:41:35 -0600
>
>I've seen this discussed before on this list, and wondered why people are
>rolling their own mail merge routines?  Personally, I find bookmarks
>cumbersome to work with and mail merge has always worked well for me with
>minimal effort.
>
>
>-----Original Message-----
>From: John Bartow [mailto:jbartow at earthlink.net]
>Sent: Tuesday, March 11, 2003 10:38 AM
>To: AccessD
>Subject: [AccessD] Word Automation
>
>
>Bryan (or any other word gurus out there),
>Can you think of a way to elegantly replace my (word automation) mail 
>merges
>with your bookmark style automation?
>
>Basically use bokmarks and some looping scheme to dump addresses it a
>prepared letter/envelope, creating one document with all of the merged
>letters/envelopes.
>
>JB
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list