Solved

Error handling while sending an email from MS Access

Posted on 2009-07-06
11
241 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
  • 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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

762 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

21 Experts available now in Live!

Get 1:1 Help Now