Link to home
Start Free TrialLog in
Avatar of kusumdv
kusumdv

asked on

Error handling while sending an email from MS Access

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
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

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
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/
 
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
 
Or the other is to send your e-mail via SMTP and skip outlook completely:

Access to Word Mail Merge to E-Mail
https://www.experts-exchange.com/questions/23257730/Access-to-Word-Mail-Merge-to-E-Mail.html#21180796
Avatar of kusumdv
kusumdv

ASKER

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.
Can you tell us on what line it is occurring and what is highlighted?
Avatar of kusumdv

ASKER

please find the screeshot
email-send-from-MS-Access1.JPG
ASKER CERTIFIED SOLUTION
Avatar of Jim P.
Jim P.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kusumdv

ASKER

thanks. its working. by the way u missed "Then" in the "If" clause
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....
>> 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.