Emailing from VBA in Access

wjburke2

Registered User.
Local time
Today, 05:37
Joined
Jul 28, 2008
Messages
194
I am looking for a way the send email's form Access without using Outlook. A friend suggested looking for a SMTP option.
I seem to have hit a dead end with Outlook. I have a application that currently uses Early binding to send emails from Access. Recently one of my users cannot use the database because they get a missing reference to MSOUTL.OLB 9.2. With the help of some of the people on this forum, I attempted to convert to late binding with no success. I keep getting the message about the program trying to access my contacts list. I do not think my users will like that. Anyway, long story short is there another way to send emails without Outlook?
 
Not sure if this will help, have you tried using DoCmd.SendObject? That is if it still works beyond 2000.

I believe this will work with the users default email program, so long as one is installed on the users PC. You just do not have much control over what goes into the email. This way you should not need to have a reference to MSOUTL.OLB.
 
you can use MAPI to communicate directly with Microsoft Exchange (I think thats the way) which avoids the need to open Outlook directly.

google search for vba mapi
 
Yo buddy,

i had the same problem but no one ever really solved it for me apart from a few people at microsft answers helped me out ( thanks guys ) so this is the code you put in a button if you have a continuous form and want to emaill all the people on it (ofocrse you can add filters and it will do the same;

Dim rst As DAO.Recordset
Dim strAdrs As String
Dim strBody As String
Dim strSQL As String

Set rst = Me.RecordsetClone <this loops through the form and grabs the clients on it

rst.MoveFirst
Do Until rst.EOF
strAdrs = strAdrs & rst!ClientEmail & " :" <field that contians email addresses
rst.MoveNext
Loop
strAdrs = Mid(strAdrs, 1)

Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
If Not (rst.BOF And rst.EOF) Then

End If

If Len(strAdrs) > 0 Then
Debug.Print strAdrs
DoCmd.SendObject , , , , , strAdrs, "subject", "and your text for the email here"
End If

end sub

or to a singal client;

Dim strEmail As String

strEmail = Me.[ClientEmail]

DoCmd.SendObject , , , strEmail, _
, , , , True
 

Users who are viewing this thread

Back
Top Bottom