Solved

DoCmd.SendObject error

Posted on 2001-09-13
4
675 Views
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.

TIA

Ewen.
0
Comment
Question by:ph0bia
  • 2
4 Comments
 
LVL 2

Accepted Solution

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

Const SW_SHOWNORMAL = 1

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
http://www.granite.ab.ca/access/email.htm

Kevin
0
 

Author Comment

by:ph0bia
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!
0
 
LVL 2

Expert Comment

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

Expert Comment

by:bundy01
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
[Mail]
MAPI=1

The working machine win.ini file looked like

[Mail]
MAPI=1
MAPIX=1
OLEMessaging=1
CMC=1
CMCDLLNAME=mapi.dll
CMCDLLNAME32=mapi32.dll
MAPIXVER=1.0.0.1


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

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

840 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