[dba-Tech] More on Word Automation

Susan Harkins ssharkins at setel.com
Fri May 11 08:22:54 CDT 2007


I tried a recordset, guess I just didn't get it right the first time -- I'll
try again -- thanks Bryan. Oh! I see where I made mistake -- you called the
document each time -- yes, that makes perfect sense to me now. Thanks!

Susan H. 

On 5/10/07, Susan Harkins <ssharkins at setel.com> wrote:
> I'm using the following procedure to copy Access data to a Word form 
> -- it's incredible simple. I'm wondering if there's a way to use this 
> process to fill multiple forms instead of using the merge feature?

There sure is.

All you need to do is use a recordset instead of Access Form fields.

Something along the lines of this air code:

Do While not rst.eof
    Set doc = appWord.Documents.Open("path\to\base\document.doc")
    with doc
        .FormFields("fldCustomerID").Result = rst.Field("CustomerID)
        .FormFields("fldCompanyName").Result = rst.Field("CustomerName) '...
etc

    end with
    ' Now here you can either save the doc with a new name,
    ' or just leave it open for the OP to deal with.
loop

That's pretty much all there is to it.

--
Bryan Carbonnell - carbonnb at gmail.com
Life's journey is not to arrive at the grave safely in a well preserved
body, but rather to skid in sideways, totally worn out, shouting "What a
great ride!"
_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com

Internal Virus Database is out-of-date.
Checked by AVG Free Edition. 
Version: 7.5.463 / Virus Database: 269.6.2/785 - Release Date: 5/2/2007 2:16
PM
 




More information about the dba-Tech mailing list