Word document linked to Access

By michaelfuhrman ·
I have an access db with records of transactions. After each transaction I need to generate a confirmation in a word document. How can I link the fields in Word to the appropriate, corresponding fields in the Access db? Can I run a macro to automatically generate a word doc after each transaction?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Try this.....

1. Why not create a Hyperlink to the Word Document?
2. If you still want to Link the Word Document, and not have it bound:
1. Enter Form Design View
2. Insert ==> Object
3. Select Create from File
4. Select Link
5. Browse ==> Select File
6. OK ==> OK
7. Set the Enabled Property of the Unbound Object Frame to Yes

Read more here:**.html

Please post back if you have any more problems or questions.

Collapse -

you don't understand

by michaelfuhrman In reply to Try this.....

After entering a new record in the access db I want to hit a command button that opens an instance of Word, copies the data fields from the most recent record and deposits them next to labels in the Word doc. Ex: if cell A2 in the db is "buyer", then this data would appear next to Buyer in the word doc.

Collapse -

Ok, Now i understand where you are going, so try this..

Dynamically generate ms word document using vba access 2007.

There are many ways to approach this
' problem. I usually begin with a word
' template containing the structure of
' the table I want to populate. Then
' open the template from vba in excel
' and begin inserting table records.

Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
Set wdDoc = wdApp.Documents.Add("")
Set wdTbl = wdDoc.Tables(1) ' containing table

' I use a function to actually populate
' the rows passing it the table id name
' and row data.

Set wdInTbl = wdTbl.Tables(2) ' table in a table

SetTableRow wdInTbl, idx, prevDate & "|" & _
prevJob & "|" & _
Format(prevTime, decFmt) & "|" & _
prevRate & "|" & _
Format(prevAmount, dolFmt)

Sub SetTableRow(tbl As Word.Table, row As Integer, lbl As String)

Please post back if you have any more problems or questions.

Collapse -

Linking Word document to Access DB

by allouttr In reply to Word document linked to A ...

Yes, you can program a Word template (macro in VBA) to do things like scanning aWord document for data items/fields in an Access DB. In the database you would first scan for a list of data items you want to confirm are in the Word doc then you use VBA scanning of the text in the document to see if those items are present and where they are located (page, line, column). You could also probably scan a Word table with VBA to see if they are there.

John James
All-Out Solutions, Inc.

Related Discussions

Related Forums