Linking Access line by line to a Word Document

G

Guest

I have tried this a lotof different ways, but not come up with the right path
yet.
I am trying to make a Word document that will link to a Accuss document. The
Word document is an invoice letter. "Below is listed the things you are
purchasing from us." The Access document is all of the stuff that we sell. I
want to be able to go through the access document and pick different things
form that list the will then be added to the Word document. I thought it
would be a simple linking thing. But everytime I try to do that it links the
whole Access document to the Word document.
If Anyone can help me with this it would be great.
 
R

Ronald W. Roberts

Diann said:
I have tried this a lotof different ways, but not come up with the right path
yet.
I am trying to make a Word document that will link to a Accuss document. The
Word document is an invoice letter. "Below is listed the things you are
purchasing from us." The Access document is all of the stuff that we sell. I
want to be able to go through the access document and pick different things
form that list the will then be added to the Word document. I thought it
would be a simple linking thing. But everytime I try to do that it links the
whole Access document to the Word document.
If Anyone can help me with this it would be great.
Method 1. Create a temp file in Access and have your Access code format
and create each full line
that contains variable information and then do a mail merge with your
document merging the full line
into your invoice letter. this will use a Dot Doc document setup for
mail merge from Access. This
will use a catalog type of document with each line being a record

Method 2. Create a Dot Dot template in Word using Bookmarks for your
variable fields.
Then you can do something like this.

Dim varX As Variant
Dim objWord As Object

' Open Microsoft Word using automation
Set objWord = CreateObject("Word.Application")
objWord.Documents.Open
FileName:="C:\SomeFolder\Some_Predefined_Template.dot"

objWord.Visible = True

varX = DLookup("[MPI_Title]", "MPIMaster", "[MPI_Index] =" & Me!MPINo1)

If objWord.ActiveDocument.Bookmarks.Exists("BookMark1") = True Then
objWord.ActiveDocument.Bookmarks("BookMark1").Range.Text = varX
objWord.ActiveDocument.Bookmarks("BookMark1").Select
End If

objWord.ActiveDocument.SaveAs FileName:="C:\SomeFolder\DocumentName.doc"
objWord.ActiveDocument.CLOSE
objWord.Quit
Set objWord = Nothing

Hope this help.
Ron
 

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