By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,472 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

MS-Access through Outlook - Sender's Name?

P: 1
Hi,

I wrote below email to send a list of emails to addressees.
Since I'm asked to send below email on behalf of my manager, Joe Jones, in which command/attribute should I put his name? Is there anything like .FROM ?

' ---------- Source Function ------------
Public Function PrintEmail(reportType As String)

Dim strMessage As String
Dim strEmail As String
Dim strMsg As String
Dim strTO As String
Dim strReportName As String
Dim oLook As Object
Dim oMail As Object

Dim db As DAO.Database
Dim rs As DAO.Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM RERIC_X_" & reportType)

strMessage = "Dear Representative:" & Chr(13) & Chr(13)
strMessage = strMessage & "Please find attached your latest Report." strMessage = strMessage & Chr(13) & Chr(13)
strMessage = strMessage & "Thank you," & Chr(13) & Chr(13)
strMessage = strMessage & "Reric99"

While Not rs.EOF

Debug.Print rs.Fields(0)

strTO = rs.Fields(3)
strReportName = rs.Fields(2)

Set oLook = CreateObject("Outlook.Application")
Set oMail = oLook.createitem(0)
With oMail
.To = strTO
.body = strMessage
.Subject = "My Report"
.Attachments.Add (strReportName)

.Send

End With

rs.MoveNext

Wend

rs.Close

Set oMail = Nothing
Set oLook = Nothing
Set rs = Nothing

End Function

' ---------- End of Function ------------

Thank you very much,
Reric99
Feb 1 '08 #1
Share this Question
Share on Google+
1 Reply


Delerna
Expert 100+
P: 1,134
yes there shoud be

try typing oMail. (don't forget the period) into your code somewhere and check the intellisense list
Feb 1 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.