Solved

DoCmd.SendObject error

Posted on 2001-09-13
4
673 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now