Sending emails from Access 2003

A

ATChurch

This is probably fairly simple, but I am having no luck finding a solution.

I want a button that will send out an email of a report from access.

It needs to go out to multiple recipients simultaneously whose contact
details are stored in a separate form. Although these are unlikely to change
all that often, so if push comes to shove the email addresses could be hard
coded into the button.

Ideally, if the only message was "Your emails have been sent" that would be
fantastic but just having it open Outlook ready to be sent would be
sufficient.
 
E

ErezM via AccessMonster.com

hi
in vba, goto tools references and add a reference to microsoft outlook
then you can use something like this:

Public Sub SendMail(strTo As String, strSubject As String, strBody As String,
strFile As String)
Dim olApp As New Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem

Set olNS = olApp.GetNamespace("MAPI")
olNS.Logon
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = strTo
If .Recipients.ResolveAll Then
.Subject = strSubject
.Body = strBody
.Attachments.Add strFile
.Send
End If
End With
Set olMail = Nothing
Set olNS = Nothing
Set olApp = Nothing
End Sub

if you run this code supplying the data needed, access will send the email
through outlook
but!! outlook will ask for your permission and delay the operation for 5
seconds before letting you (and your users) to continue
to make it totally automatic with no confirmations and delays, you need to
bypass outlook's security
there are many solutions on the net for that, i use and like very much
MapiLab's security for outlook, it will ask you what to do the first time you
send mail from access, then, if you set it right it wont ask you again

now, this sends an attached file, which means you'll need to create a saved
file from the report before being able to send it

good luck
 
A

ATChurch

Thanks for the swift reply. Just some followup questions.

My VBA programming skills are not that good, are the areas in the code you
provided that I need to change to "my values" the "As String" parts?

Secondly, you said I "need to create a saved file from the report before
being able to send it" Can this be done using the same button? Preferably
deleting it afterwords. I'm after a "send email" button where all the
information needed is in the database, so as little interaction from the user
as possible.
 
G

Gee

I'm needing this answer too...can you tell me where I'm supposed to supply
the data needed?
Thanks
 

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