Help Newbie Question

  • Thread starter Thread starter Lion King
  • Start date Start date
L

Lion King

Hi Guys,

I was wondering if someone could advise or point me in he right direction to
link a word document to MS Access Database. My Database will have records
of many different people each person will have an individual word document
that I want to be able to view or launch when I am viewing the a given
persons form data.

I hope ive explained what i want clearly,

Thanks in advance for any help

Kind Regards
 
Add fields that contain file path (DocPath) and document name (DocName) to
the table.

(I strongly recommend storing this in a separate table and adding a link to
the primary key field from this Documents table to a field you will add to
your People table.


Add the DocPath and DocName fields from your Documents table to the form
that has your People. Put a command button in the form.

With the Wizard, choose Application and Run MS Word. That will give you the
code framework. Open the code page and add to the text there so that you
now have something like


Private Sub cmbRunWord_Click()
On Error GoTo Err_cmbRunWord_Click

Dim oApp As Object
Dim MyFile As String

MyFile = Me.DocPath & Me.DocName
'join the data in DocPath and DocName

Set oApp = CreateObject("Word.Application")
oApp.Visible = True

oApp.Documents.Open MyFile

Exit_cmbRunWord_Click:
Exit Sub

Err_cmbRunWord_Click:
MsgBox Err.Description
Resume Exit_cmbRunWord_Click

End Sub


Substitute the names with your real control names.

If you don't understand any of this. Please ask.

Evi
 
Back
Top