Solved

Error handling while sending an email from MS Access

Posted on 2009-07-06
11
243 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 7 33
Error when attempting to use Replace function in Access 2010 sql query 4 18
Filter cbo on datasheet - 11 31
Question about DB Schema 27 52
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
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…
Familiarize people with the process of utilizing SQL Server functions 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 Microsoft Ac…
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…

786 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