Solved

Error handling while sending an email from MS Access

Posted on 2009-07-06
11
247 Views
Last Modified: 2012-05-07
Hi
when sending email from MS access, A dialog appears asking some program is trying to access outlook and do you want to continue. In that Dialog, If I click know , I am getting runtime error.
Could anyone please help me how to handle that error
Please find the screeshot attached.

Thanks
email-send-from-MS-Access.JPG
0
Comment
Question by:kusumdv
[X]
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
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 24786286
Hello kusumdv,

That is an Outlook security measure implemened starting in Outlook 2000 SP2, and persisting
at least through 2002 and 2003.

To disable it, I've used three products:

1) Express ClickYes
http://www.contextmagic.com/express-clickyes/
There is a free version and a Pro version for ~$30 with more features.  I've used the pro version.
It works as advertised.  I'm not using it currently.  I'm using the MAPILab product instead.

2) MAPILab Advanced Outlook Security
http://www.mapilab.com/outlook/security/
A free COM add-in for Outlook.  I am using it now and I like it

3) Redemption
http://www.dimastr.com/redemption/
A DLL you can use in your code to disable the warnings.  Free download, but you must pay a
license to distribute.  I've used it and like it.

Now, if you want an error handler, please post your code.

Regards,

Patrick
0
 
LVL 10

Expert Comment

by:therealmongoose
ID: 24786290
It's an in buit "Feature" that microsoft installed after the I Love You virus went round... There's a free download which works very well that get's around this....
 
http://www.mapilab.com/outlook/security/
 
0
 
LVL 38

Expert Comment

by:Jim P.
ID: 24786334
You would have to put an error handler in your code

On Error GoTo ErrorTrap

'your code

Exit Sub 'or Function

ErrorTrap:

If Err.Num = 2293
    MsgBox "E-mail not sent.", vbCritical
    Err.Num = 0
    Resume Next
Else
    Exit Sub 'or Function
End if
End Sub
 
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 38

Expert Comment

by:Jim P.
ID: 24786362
Or the other is to send your e-mail via SMTP and skip outlook completely:

Access to Word Mail Merge to E-Mail
http://www.experts-exchange.com/Q_23257730.html#21180796
0
 

Author Comment

by:kusumdv
ID: 24787669
When I use the below code:

You would have to put an error handler in your code

On Error GoTo ErrorTrap

'your code

Exit Sub 'or Function

ErrorTrap:

If Err.Num = 2293
    MsgBox "E-mail not sent.", vbCritical
    Err.Num = 0
    Resume Next
Else
    Exit Sub 'or Function
End if
End Sub
 
I am getting Run-time error which says:
Run-time error: 438
Object doesnot support this property or method.
0
 
LVL 38

Expert Comment

by:Jim P.
ID: 24787744
Can you tell us on what line it is occurring and what is highlighted?
0
 

Author Comment

by:kusumdv
ID: 24787826
please find the screeshot
email-send-from-MS-Access1.JPG
0
 
LVL 38

Accepted Solution

by:
Jim P. earned 500 total points
ID: 24787955
Ok, sorry Typo

it should be err.Number

And the
On Error GoTo ErrorTrap
 
'your code
 
Exit Sub 'or Function
 
ErrorTrap:
 
If Err.Number= 2293
    MsgBox "E-mail not sent.", vbCritical
    Err.Number= 0
    Resume Next
Else
    msgbox Err.Number & ": " & err.Description 
    Exit Sub 'or Function
End if
End Sub

Open in new window

0
 

Author Closing Comment

by:kusumdv
ID: 31600207
thanks. its working. by the way u missed "Then" in the "If" clause
0
 
LVL 10

Expert Comment

by:therealmongoose
ID: 24788009
Handling the error will let the code continue, but does not get around the problem of the email not being sent - in order to get around the message completely you need to install one of the suggested programs or use smtp as per the above posts....
0
 
LVL 38

Expert Comment

by:Jim P.
ID: 24788033
>> by the way u missed "Then" in the "If" clause

You're right, but this is aircode. Generally I code that you will never have to error handle like this. I'll go and do direct SMTP code. I force the users into the slot and fire the code. they don't get a chance to stop it.

Glad to be of assistance. May all your days get brighter and brighter.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

749 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