Link to home
Start Free TrialLog in
Avatar of WonHop
WonHopFlag for United States of America

asked on

Run-time Error 2287 - Using SendObject

I am trying to use the SendObject to send emails.  I am gettting the following message.  I have use this several times before.

Could someone please help?

Run-time Error 2287
Microsoft Access can’t open mail session

Check your mail application to make sure it’s working properly

Thanks
WonHop

Avatar of zuijdhoek
zuijdhoek

Does your mail-application work properly? Did you test it? What happens if you try to send a regular email?
Avatar of WonHop

ASKER

Yes it does.  I can send and receive just fine.
Avatar of WonHop

ASKER

I am using Access 97 and Outlook 2000
Do you gfet the same error when trying to send from Word or Excel, if not are they the same version as Access installed with the office suite, or is Access a seperate install (stand alone)?
If you get the same error using File, Send from any office application, then it may be a case of how a profile is set up or the mail application is installed.

You could try reinstalling Office.
if this doesn't work then you may need to uninstall Outlook and Office, run a reg clean, then reinstall Outlook first then office
what parameters are you using....  
Avatar of WonHop

ASKER

blakeh1:  I have Office 2000, but Access 97.  I can do a File Send from Excel and Word.  All of the other parts of the code work just fine.  It blows up when it gets to the SendObject line

papatsfann: This is the copy of the code I am using.

Function Send_Price_List()

Dim db As Database
Dim rst_Email_Price As Recordset
Dim datDate As String
Dim tmeTime As String
Dim ForDate As String
Dim ForTime As String
Dim olapp As Object
Dim strCustomerEmail
Dim strSubject As String
Dim strMessage As String

Set olapp = CreateObject("Outlook.Application")

ForDate = Date
ForTime = Format(Time(), "h:m")

Set db = CurrentDb

DoCmd.SetWarnings False
Set rst_Email_Price = db.OpenRecordset("tbl_Email", DB_OPEN_DYNASET)

If rst_Email_Price.RecordCount < 1 Then
    MsgBox "No 30 Day Records"
    Set rst_Email_Price = Nothing
    Exit Function
End If

rst_Email_Price.MoveFirst

Do Until rst_Email_Price.EOF

strCustomerEmail = rst_Email_Price!Email_Address
strSubject = "Photography"
strMessage = "Test Message"

DoCmd.SendObject , , , strCustomerEmail, , , strSubject, strMessage, True

         With rst_Email_Price
            .Edit
            !Sent_Email = True
            .Update
         End With

rst_Email_Price.MoveNext

Loop

Set rst_Email_Price = Nothing
DoCmd.SetWarnings True
End Function

Thanks
WonHop
Avatar of Brendt Hess
I had a similar problem in Access 2.0 that was simply resolved by manually starting Outlook prior to running the Access macro/procedure.

In Access97, you could set a reference to the Outlook object, and start it from your program instead.  In either case, Outlook must be running before Sending the mail.
Avatar of WonHop

ASKER

Thanks bhess1.  The reference to Outlook 9 is already set and Outlook is open.  That was the first thing I looked for.

WonHop
ASKER CERTIFIED SOLUTION
Avatar of blakeh1
blakeh1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WonHop

ASKER

Thanks guys.  I have not yet found the exact probem.  I did find out that there is something wrong with my computer.  I went to two other computers and it worked just fine.

blakeh1: I would like to award you the points for the code you posted.  My next step was going to be adding an attachment.  The code you posted shows me how to accomplish that.

Thanks
WonHop
Avatar of WonHop

ASKER

blackeh1:  Thanks for your response. I used the code, made some modificaions and it worked great.

Thanks alot.
WonHop