I'm outputting an access report to .rtf (for attachment to an automatic email), but the problem is that an .jpg embedded in the report doesn't make it into the word file. Is there a way to modify my code to make it export with the rest of the report?
Perhaps it's possible to insert the .jpg into the .rtf later using VBA?
==========================================================
Here's my code:
Private Sub Objective_DblClick(Cancel As Integer)
Dim dbs As Database
Dim rst As Object
Dim qry As QueryDef
Dim CallID As Long
Dim strDocName, strOutputPath, strOutputFile As String
Dim OPenView As Boolean
Set dbs = CurrentDb
For Each qdf In dbs.QueryDefs
If qdf.Name = "qryCallDetail" Then DoCmd.DeleteObject acQuery, "qryCallDetail"
Next qdf
CallID = Me.CallID
Set qry = dbs.CreateQueryDef("qryCallDetail", "SELECT tblCallers.CallerName, tblCallers.Phone1, tblCallers.Phone2, tblCallers.Email, tblConsultants.ConsultantName, tblProduct.ProductName, tblCall.CallID, tblCall.Client, tblCall.Date, tblCall.Location, tblCall.ConsultantAttendee1, tblCall.ConsultantAttendee2, tblCall.ConsultantAttendee3, tblCall.ConsultantAttendee4, tblCall.ConsultantAttendee5, tblCall.ClientAttendee1, tblCall.ClientAttendee2, tblCall.ClientAttendee3, tblCall.ClientAttendee4, tblCall.ClientAttendee5, tblCall.Objective, tblCall.Overview, tblCall.Topics, tblCall.Status, tblCall.FollowUp " & _
"FROM ((tblCallers INNER JOIN tblConsultants ON tblCallers.CallerID = tblConsultants.CallerID) INNER JOIN tblProduct ON tblConsultants.ConsultantsID = tblProduct.ConsultantsID) INNER JOIN tblCall ON tblProduct.ProductID = tblCall.ProductID " & _
"WHERE (((tblCall.CallID)=" & CallID & "));")
strDocName = "rptMeetingDetail"
DoCmd.OpenReport strDocName, acPreview, , strWhere
strOutputFile = "test.rtf" 'this will get changed later to give a unique file name base on date/time
strOutputPath = "\\Ncateav4\cavol4\PTRUST\Communications\MGrabowski\" & strOutputFile
OPenView = False
DoCmd.OutputTo acReport, strDocName, acFormatRTF, strOutputPath, OPenView
End Sub
Perhaps it's possible to insert the .jpg into the .rtf later using VBA?
==========================================================
Here's my code:
Private Sub Objective_DblClick(Cancel As Integer)
Dim dbs As Database
Dim rst As Object
Dim qry As QueryDef
Dim CallID As Long
Dim strDocName, strOutputPath, strOutputFile As String
Dim OPenView As Boolean
Set dbs = CurrentDb
For Each qdf In dbs.QueryDefs
If qdf.Name = "qryCallDetail" Then DoCmd.DeleteObject acQuery, "qryCallDetail"
Next qdf
CallID = Me.CallID
Set qry = dbs.CreateQueryDef("qryCallDetail", "SELECT tblCallers.CallerName, tblCallers.Phone1, tblCallers.Phone2, tblCallers.Email, tblConsultants.ConsultantName, tblProduct.ProductName, tblCall.CallID, tblCall.Client, tblCall.Date, tblCall.Location, tblCall.ConsultantAttendee1, tblCall.ConsultantAttendee2, tblCall.ConsultantAttendee3, tblCall.ConsultantAttendee4, tblCall.ConsultantAttendee5, tblCall.ClientAttendee1, tblCall.ClientAttendee2, tblCall.ClientAttendee3, tblCall.ClientAttendee4, tblCall.ClientAttendee5, tblCall.Objective, tblCall.Overview, tblCall.Topics, tblCall.Status, tblCall.FollowUp " & _
"FROM ((tblCallers INNER JOIN tblConsultants ON tblCallers.CallerID = tblConsultants.CallerID) INNER JOIN tblProduct ON tblConsultants.ConsultantsID = tblProduct.ConsultantsID) INNER JOIN tblCall ON tblProduct.ProductID = tblCall.ProductID " & _
"WHERE (((tblCall.CallID)=" & CallID & "));")
strDocName = "rptMeetingDetail"
DoCmd.OpenReport strDocName, acPreview, , strWhere
strOutputFile = "test.rtf" 'this will get changed later to give a unique file name base on date/time
strOutputPath = "\\Ncateav4\cavol4\PTRUST\Communications\MGrabowski\" & strOutputFile
OPenView = False
DoCmd.OutputTo acReport, strDocName, acFormatRTF, strOutputPath, OPenView
End Sub