Link to home
Start Free TrialLog in
Avatar of WSIT
WSIT

asked on

Error 13 (type mismatch) when sending emails from access

Hi

I'm getting error 13 (type mismatch) when attempting to send emails from within Access 2003.

My code (which works for other clients) is:

Global OutlookApplication As Outlook.Application, OutlookMail As Outlook.MailItem, Inbox As Outlook.MAPIFolder, DetailSectionLeftDescriptionLabel As String

Set OutlookApplication = New Outlook.Application
Set OutlookMail = Outlook.Application.CreateItem(olMailItem)

I get error 13 with the last line.  The Client has Access 2003 and Office 2010 on a 32bit Win 7 PC.  The project has a reference for Microsoft  Outlook 14.0 Object Library added and I have tried moving it up the reference list as far as it can go.

Any help would be appreciated

Kim
Avatar of mbizup
mbizup
Flag of Kazakhstan image

No obvious type mismatch issue jumping out at me, but try changing the last line to reference the outlook application object that your code created in the previous statement:

Set OutlookMail = OutlookApplication.CreateItem(olMailItem)


(I've dropped the 'dot' in Outlook.Application)
Also, just for kicks - If you don't have it already, place the following line at the top of this code module, right under Option CompareDatabase:


Option Explicit

Open in new window


Then compile your code, fixing any errors to ensure that all variables, Outlook constants, etc are recognized on your client's computer.
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan 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 WSIT
WSIT

ASKER

I in the process of testing your ideas when I got a call to say they 'repaired' the Office installation and it then worked fine.  Why it would need repairing on all three PCs I couldn't tell you.  But thanks for the help.