Hi,
I have a query which looks at the active form to identify the record I want to export to a Word Document:
SELECT tblInterview.InterviewID, tblInterview.DateInterviewed, tblStudents.StudentNo, tblStudents.LastName, tblStudents.FirstName, tblStudents.ScholasticYear, tblInterview.InvoiceAmt
FROM tblStudents INNER JOIN tblInterview ON tblStudents.StudentNo = tblInterview.StudentNo
WHERE (((tblInterview.InterviewID)=[Forms]![frmSubInterview]) AND ((tblInterview.InvoiceStudent)=Yes));
The word document is saved as a template file (.dotx) and is linked as a mail merge document to the above query.
When I create a document from the template, it all works fine. My next problem is to create a control on my form [frmSubInterview] which will open MS Word, in particular the template, so that the document can be printed and then saved.
Could someone please advise me.
I've looked at several examples on the Internet but can't seem to get it to work.
This attempt comes up with a compile error User-defined type not identified on the first line of code.:
Private Sub CmdWord_Click()
Dim wordApp As Word.Application
Dim wordDoc As Word.Document
Set wordApp = New Word.Application
With wordApp
.Visible = True
Set wordDoc = .Documents.Open(".../DamagesTemplate.dotx", , False)
End With
End Sub
Thanks in advance for any support.