How to pass data from Access to Word Document

B

Bill Agee

I am a user of Access and have a fair amount of knowledge about VBA (Access
only). I can open the Word document from Access and capture the Access data
in variables (vname=Name, vAddress1=Address1, etc) but I need to pass name,
address, city, state, zip to a Word document and have Word pick up this data
and replace it "holders" as
follows:

Date

<Name>
<Address1>
<Address2>
<City>, <State> <Zip>

I have no idea where to start, even where to read. Can anyone point me in
the right direction?

Bill
 
D

Doug Robbins - Word MVP

Hi Bill ,

Instead of the "holders" in the document, insert { DOCVARIABLE "varname" }
fields at those locations, then in your code, after you have opened the
document use

[DocumentObject].Variables("varname").Value = [Accessdataitem]
'repeat for each varname, Accessdataitem

then finally,

[DocumentObject].Fields.Update

[DocumentObject] being a reference to the document object that you say you
have created.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top