Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Report as email attachement does not render report pictures

Posted on 2013-10-23
6
Medium Priority
?
446 Views
Last Modified: 2013-10-23
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

0
Comment
Question by:gogetsome
  • 3
  • 3
6 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39594768
...and what is your entire SendObject code?

Perhaps the format you are using does not support images...?
0
 

Author Comment

by:gogetsome
ID: 39594815
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

0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 39595108
Again, what output format are you specifying?
Because you left this argument blank in your code, it should popup and ask you for the format...
...In any even, when I select "PDF" as the output format, the images display fine in the resulting, attached PDF file...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:gogetsome
ID: 39595186
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?
0
 

Author Closing Comment

by:gogetsome
ID: 39595409
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
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39595537
oK great
;-)

BTW, what were you using before?
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question