Send Email Attachment

K

KaiRich

Hi,

I want Access 2000 to send emails with attachments.
This code is automatically run by the 'system'.
I can get Access to send emails without attachments, and I
can get Access to create an email with an attachment - but
it asks me who to send it to. But I can't get it to do
both.

This is my code to send an email:
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.Subject = SubjectStr
myItem.To = Recipient
myItem.Body = MsgText
myItem.Attachment = Reports("DueMonth")
myItem.Send

This is my code to create an email with an attachment:
DoCmd.SendObject acSendReport, "DueMonth", _
acFormatRTF, Recipient, , , SubjectStr, MsgText, False

In the first one
myItem.Attachment = Reports("DueMonth")
doesn't work.
In the second on it doesn't seem to load the Recipient and
send it itself.

Anyone know what's wrong?

Thanks in advance,
Kai
 
R

Resolved - KaiRich

I have resolved this.

DoCmd.SendObject acSendReport, AttachmentRpt, acFormatRTF,
Recipient, , , SubjectStr, MsgText, False

Works. Instead of using text in "", I have used a
variable 'AttachmentRpt' and set it previously to the
string "rpt_BlahBlah". This works, slowly, it takes some
time, but it works.

- KaiRich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top