Link to home
Start Free TrialLog in
Avatar of gogetsome
gogetsomeFlag for United States of America

asked on

Report as email attachement does not render report pictures

Hello, when I print preview a report if the report contains pictures they display. However, if I use DoCmd.SendObject acReport, stDocName to attach the report to an email the pictures do not render on the report. The pictures are linked and not in the database. On the report I populate the images with the following code.


Why do the images appear when I print the report but not when the report is an attachment to an email?

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
DefaultFilePath = GetDefaultFilePath
    If Me!txt_Picture1 > "" Then
    Me!Picture1.Picture = DefaultFilePath & Me!txt_Picture1
    End If
    If Me!txt_Picture2 > "" Then
    Me!Picture2.Picture = DefaultFilePath & Me!txt_Picture2
    End If
    If Me!txt_Picture3 > "" Then
    Me!Picture3.Picture = DefaultFilePath & Me!txt_Picture3
    End If
   
    
End Sub

Open in new window

Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

...and what is your entire SendObject code?

Perhaps the format you are using does not support images...?
Avatar of gogetsome

ASKER

Here is my code:
Private Sub btn_Supplier_Click()

On Error GoTo ErrorHandler

Dim emailList As String
Dim qdf As QueryDef
Dim rst As Recordset
Dim myPrice As Currency

Set qdf = CurrentDb.QueryDefs("Get_EmailDistributionListBySupplier")

qdf.Parameters(0) = Me.txt_Supplier.Value

Set rst = qdf.OpenRecordset

If rst.RecordCount > 0 Then

Do Until rst.EOF
   emailList = emailList & rst![email Address] & "; "
   rst.MoveNext
Loop

emailList = Left(emailList, Len(emailList) - 1)

Dim stDocName As String
stDocName = "DMR_Single View"
   
DoCmd.SendObject acReport, stDocName, , emailList

Else

  MsgBox "There are no email addresses in the database for this supplier."
  DoCmd.Hourglass False
  Resume ExitHandler
 
 End If
  
ExitHandler:
Set rs = Nothing
Set db = Nothing
Forms("DMR Tracking").Visible = True
Exit Sub

ErrorHandler:
Select Case Err
Case 2501
Resume ExitHandler
Case Else
Resume ExitHandler
End Select

End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You talking about the output format for the attachment?

Yes, a popup does ask a format type; however; pdf is not in the list (access 2003).

This

DoCmd.SendObject acReport, stDocName, pdf, emailList

still gives a popup for the type.

Am I lost here?
Thank you boag2000 for the newb time! Since 2003 does not do PDF natively. We are going to force snapshot as the format.

This works perfectly:

DoCmd.SendObject acReport, stDocName, acFormatSNP, emailList
oK great
;-)

BTW, what were you using before?