WonHop
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
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
Does your mail-application work properly? Did you test it? What happens if you try to send a regular email?
ASKER
Yes it does. I can send and receive just fine.
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
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....
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.Appl ication")
ForDate = Date
ForTime = Format(Time(), "h:m")
Set db = CurrentDb
DoCmd.SetWarnings False
Set rst_Email_Price = db.OpenRecordset("tbl_Emai l", DB_OPEN_DYNASET)
If rst_Email_Price.RecordCoun t < 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_Addr ess
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
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.Appl
ForDate = Date
ForTime = Format(Time(), "h:m")
Set db = CurrentDb
DoCmd.SetWarnings False
Set rst_Email_Price = db.OpenRecordset("tbl_Emai
If rst_Email_Price.RecordCoun
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_Addr
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
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.
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.
ASKER
Thanks bhess1. The reference to Outlook 9 is already set and Outlook is open. That was the first thing I looked for.
WonHop
WonHop
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER
blackeh1: Thanks for your response. I used the code, made some modificaions and it worked great.
Thanks alot.
WonHop
Thanks alot.
WonHop