Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

embed chart into email body

Status
Not open for further replies.

jminn0311

Technical User
Jan 7, 2004
66
US
I have a form that is emailed to management detailing my days activities. I wrote some code so data is pulled from the form and written to the body of the email so opening the file is not required. I also have a chart that I would like to insert into the body of the email, but the coding escapes my simple mind. The chart is located on a report named "rptProductionConstraintsForEmail". Does anyone have a solution to this problem?

Private Sub E_MAIL_Click()
On Error GoTo Err_E_MAIL_Click

Dim rsEmails As Recordset
Dim strEmails As String


'select the current record and send the report that is based on that record.
DoCmd.RunCommand acCmdSelectRecord
strText = "Date: " & Me.DATE & Chr$(13) & "Shift: " & Me.Shift & Chr$(13) & Chr$(13)
strText = strText & "Feed Rate: " & Me.FeedRate & Chr$(13) & Chr$(13)
strText = strText & "Slop Feed Rate: " & Me.SlopFeedRate & Chr$(13) & Chr$(13)
strText = strText & "Incoming Rate: " & Me.IncomingRate & Chr$(13) & Chr$(13)
strText = strText & "Y-Grade Inventory: " & Me.YGradeInventory & Chr$(13) & Chr$(13)
strText = strText & "Slop Feed Inventory: " & Me.SlopInventory & Chr$(13) & Chr$(13)
strText = strText & "Primary Constraint: " & Me.ProductionConstraint1 & Chr$(13) & Chr$(13)
strText = strText & "Secondary Constraint: " & Me.ProductionConstraint2 & Chr$(13) & Chr$(13)
strText = strText & "Equipment Issues: " & Me.EquipmentIssues & Chr$(13) & Chr$(13)
strText = strText & "Quality Issues: " & Me.ProductQualityIssues & Chr$(13) & Chr$(13)
strText = strText & "Storage Issues: " & Me.StorageFieldIssues & Chr$(13) & Chr$(13)
strText = strText & "Pipeline Issues: " & Me.PipelineIssues & Chr$(13) & Chr$(13)
strText = strText & "Comments: " & Me.COMMENTS

Set db = CurrentDb()
Set rsEmails = db.OpenRecordset("select * from tblConstraintEmailAddresses", dbOpenDynaset, dbReadOnly)
rsEmails.MoveFirst

Do Until rsEmails.EOF
If rsEmails.Fields(0) <> "" Then
strEmails = strEmails & rsEmails.Fields(0) & ";"
End If
rsEmails.MoveNext
Loop

DoCmd.SendObject acSendReport, "rptProductionConstraintsForEmail", acFormatSNP, strEmails, , , "Bushton Frac Production Constraints - " & Me.Shift & " Shift " & Me.DATE, strText

Exit_E_MAIL_Click:
Exit Sub

Err_E_MAIL_Click:
MsgBox Err.Description
Resume Exit_E_MAIL_Click

Thanks for any help,

Jeff M.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top