Displaying OLE objects in a report (Access 97)

  • Thread starter Thread starter Satchel
  • Start date Start date
S

Satchel

Guest
:confused: I have a (table) and report where one of the fields is a linked OLE Object (a word document). How can I get the full word document to appear in the report (the word documents range from one to five pages of text). I've been told that this can't be done but am in denial as if this cant be done the entire usefulness of my database is negated.

Thank you for any help you can give me.
 
Hi,
If you want to print the word document at the end of your report I know that this works.....

Private Sub Report_Close()
On Error GoTo openerror

Dim WordApp As Word.Application
Dim WordDoc As Word.Document

Set WordApp = New Word.Application
Set WordDoc = New Word.Document

Set WordDoc = WordApp.Documents.Open("file & path")
WordDoc.PrintOut
WordDoc.Close

Set WordApp = Nothing
Set WordDoc = Nothing

Exit Sub
openerror:
If Err.Number = 5174 Then
MsgBox "The file could not be found"
Else
MsgBox "There was an error"
End If
End Sub

With this code you could have the file & path part as a variable so you could pick whichever word document you wanted to print depending on the values in the record. If you want to print a word document for each record and you want one record per page you can always feed the report one record at a time using a function that loops through your recordset.

hope this helps

L
 

Users who are viewing this thread

Back
Top Bottom