Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Report as email attachement does not render report pictures

Posted on 2013-10-23
6
436 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 500 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

839 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