DoCmd.SendObject error

Posted on 2001-09-13
Medium Priority
Last Modified: 2012-06-27
When using sendobject my code for some reason gives me this error

Run time error 2287 % can't open the mail session

This is only occuring on one of the 5 machines I have installed it on.
So far the things I have tried are making sure outlook express is the default mail program (has to be to work properly)
A microsoft KB article said something about the registry but I have ruled that one out by installing on a 6th machine.

I am completly stuck on this one so any help would be appreciated. I am using Access 2000 if anyone wanted to know and it is installed on a WinME machine.

Just to reiterate my code works fine sending the email on 5 other machines so it is not the code that is wrong but something to do with the setup of the machine.


Question by:ph0bia
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

gallaghe earned 150 total points
ID: 6490508
If you want to send an email from MS-Access


Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
   (ByVal hwnd As Long, _
   ByVal lpOperation As String, _
   ByVal lpFile As String, _
   ByVal lpParameters As String, _
   ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
   If ShellExecute(Me.hwnd, "open", _
                   "mailto:SomeOne@Here.com" & _
                   "?Subject=Learning how to get rid of first body line" & _
                   "&cc=Goofy" & _
                   "&bcc=Dilbert" & _
                   "&body="Your message goes here.", _
                   vbNullString, _
                   vbNullString, _
                   SW_SHOWNORMAL) <= 32 Then
      MsgBox "Some error message"
   End If
End Sub

or check out


Author Comment

ID: 6490571
I'd rather not change any of my code because the system is already being run on 5 other machines in the company. I want to try and get it to work like the others on this one machine. It runs fine on Win98, WinNT and on one WinME box.... just not this one!

Expert Comment

ID: 6490606
ShellExecute is non-discriminatory as oppose to SendObject, you might consider it rather then getting the broken one to work.

Expert Comment

ID: 7354918
I had the same problem and found the Run time error 2287 caused by the [Mail] setting in win.ini file

An NT box was missing variables that caused Run time error 2287 % can't open the mail session, whilst another WinMe machine was fine

The faulty machine win.ini had the follwoing entry

The working machine win.ini file looked like


As soon as I changed the win.ini file the problem was fixed.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question