Hai,
I am developing an application of Resume Maintenance, and Resumen(word documents) are stored in the database using OLE object Field. In the form, I am attaching the word document into a OLE object control(Bound Object Frame Control) using Common Dialog Control.
Here is the deal :
I am able Attach, View the contents of the Field. But I couldn't print the Document. But I am able to print the contents of currently attache document using SourceDoc property of the OLE control. But I couldn't print the contents, becuase MS Access is not maintaining the SourceDoc.
This is my code for Attach, View & Print:
Private Sub cmdAttach_Click()
comDlg.ShowOpen
Me.CandidateResume.SourceDoc = comDlg.FileName
Me.CandidateResume.Action = acOLECreateEmbed
End Sub
'Print the document
Private Sub cmdPrint_Click()
Dim obj As word.Application
' This line where I am getting error.
' I couldn't map the ole object with Word object.
Set obj = Me.CandidateResume.Object
'To open the word document
Me.CandidateResume.Action = acOLEActivate
With obj
.Documents.Open me.CandidateResume.SourceDoc
'To avoid interruption of other process while printing
.PrintOut background:=False
.Quit
End With
Set obj = Nothing
End Sub
'View the Document
Private Sub cmdView_Click()
Me.CandidateResume.Action = acOLEActivate
End Sub
Please let me know, can anybody correct this code or having alternate solution.
Thanks in Advance
I am developing an application of Resume Maintenance, and Resumen(word documents) are stored in the database using OLE object Field. In the form, I am attaching the word document into a OLE object control(Bound Object Frame Control) using Common Dialog Control.
Here is the deal :
I am able Attach, View the contents of the Field. But I couldn't print the Document. But I am able to print the contents of currently attache document using SourceDoc property of the OLE control. But I couldn't print the contents, becuase MS Access is not maintaining the SourceDoc.
This is my code for Attach, View & Print:
Private Sub cmdAttach_Click()
comDlg.ShowOpen
Me.CandidateResume.SourceDoc = comDlg.FileName
Me.CandidateResume.Action = acOLECreateEmbed
End Sub
'Print the document
Private Sub cmdPrint_Click()
Dim obj As word.Application
' This line where I am getting error.
' I couldn't map the ole object with Word object.
Set obj = Me.CandidateResume.Object
'To open the word document
Me.CandidateResume.Action = acOLEActivate
With obj
.Documents.Open me.CandidateResume.SourceDoc
'To avoid interruption of other process while printing
.PrintOut background:=False
.Quit
End With
Set obj = Nothing
End Sub
'View the Document
Private Sub cmdView_Click()
Me.CandidateResume.Action = acOLEActivate
End Sub
Please let me know, can anybody correct this code or having alternate solution.
Thanks in Advance