[AccessD] FW: A2003: Runtime Error Type Mismatch (SOLVED)

Erwin Craps - IT Helps Erwin.Craps at ithelps.be
Fri Mar 11 03:03:30 CST 2005


Darren, 

It's not an early binding issue....
(read my other post)

It's a type issue.
Not all items in an outlook folder are necesary from the same type.

So indeed you need to change your declaration to object 
BUT
You also need to check in your loop to only process the appointment
items....
And/or to process the other items appropriatly.
You code can still fail if you request a specific appointment property
on a non-appointment item...

Erwin


 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren DICK
Sent: Friday, March 11, 2005 5:36 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] FW: A2003: Runtime Error Type Mismatch (SOLVED)

Hello all
Got an answer from Sue
Needed to replace the early binding item...
Dim myAppt As Outlook.AppointmentItem
With
Dim myAppt As object

See y'all

Darren


ORIGINAL MESSAGE:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

(Cross Posted to Dmitry and Sue's List)

Hello all
I have the code below working fine until today It errors on the last
line in this code The error is Runtime Error 13 Type Mismatch

Can anyone explain why it used to work - now it doesn't?
References are good - Though once this rubbish started I manually
removed them and re attached them - no luck OFFICE 11

May thanks in Advance

Darren

'+++++++++++++++++++<SNIP>
   Dim ol As Outlook.Application
   Dim olns As Outlook.NameSpace
   Dim objFolder As Outlook.MAPIFolder
   Dim AllAppts As Outlook.Items
   Dim myAppt As Outlook.AppointmentItem
        
    Set ol = New Outlook.Application
    Set olns = ol.GetNamespace("MAPI")

    Set objFolder = olns.GetDefaultFolder(olFolderCalendar)
    Set AllAppts = objFolder.Items
        
    Dim appSQL As String
    Dim strOutLookID  As String
        
    For Each myAppt In AllAppts '<======ERROR IS HERE

'++++++++++</Snip>


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list