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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to send email from access 2000

Status
Not open for further replies.

Bing101

MIS
May 21, 2003
1
US
I have a access 2000 db that has a form I select names from a drop down box. It generates a report that includes a brief message and inserts all the names that i selected on my previous form. At that point I am stuck, how do i get access 2000 to email a copy of that report to all the names selected. Thanks in advance.
 
MS Access does not have the ability to send email. However you can call Outlook from Access and ask Outlook to send the mail. This is an example:

Public Sub basSendMail()

Dim objMailItem As MailItem

Set objMailItem = Application.CreateItem(olMailItem)

With objMailItem
.To = "rasx@kintespace.com"
.Subject = "Is Haley's Comet for You?"
.Body = "This is the body text."
.Send
End With

End Sub

Unfortunately my example is written to run from inside Outlook so you will have to modify this code to run it inside of Access.


Bryan Wilhite
info@songhaysystem.com
 
bing101,

I have seen other people use similar to this .

Dim To As String
Dim CC As String
Dim BCC As String
Dim Msg As String
Dim ReportName As String
To = 'who to send to'
CC = 'who to cc'
BCC = 'who to bcc'
Msg = 'body of email'
ReportName = 'report you want to send'
SendMessage To, CC, BCC, 'email title', _
Msg, False, ReportName

Public Sub SendMessage(To As String, CC As String,_
BCC As String, _
Subject As String, Msg As String, ReportName As String)
DoCmd.SendObject acSendReport, ReportName, acFormatRTF,
To:=To & ";", _
Bcc:=BCC, _
Subject:=Subject, _
MessageText:=Msg, _
End Sub

regards,

longhair
 
rasx has the right of it, but there are other problems associated with sending mail from Access.

1) MailItem.Send only puts the message in the Outbox. The mail still has to be sent. This isn't an issue if Outlook is set to send mail immediatly.

2) I have not yet found a way to embed picture items into an email. This has the nasty of side-effect of requiring you to use http: links for any images you send via HTML formatted mail.

3) I see no way to change the default format to RTF aside from selecting that option in Outlook. Setting the MailItem.HTMLBody property through code, however, will set the MailItem.Inspector.EditorType to use HTML.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top