T
The Facilitator
I am having an issue with a project I am involved in concerning a MAPI
folder. In the following snippet of code you will see that Access is
trying to connect to Outlook to import the tasks for analysis. The
original code was written in Access 2002, on a Win2K3 server. I had
to copy the database onto my laptop so that I could work on it off
site. My laptop has Office 2003 on Windows XP Pro. After I worked on
the database (without affecting any coding, I was working on the
reports and the switchboard), it will no longer work in Access 2002.
The file format is still Access 2000. The line of code that
generates the error is marked with stars after it. It seems it does
not like the version of MAPI on the original machine. I do not have
any choice, the client needs it on 2002 and no changes to any DLL's is
allowed, due to it being a secure environment. Their IT department
would have a fit it I suggested having to load other DLL's onto their
machines.
My question is, how do I re-point the database to the 2002 version of
MAPI, not the 2003. I had the same issue with using Outlook 2003 and
had to drop in the Outlook library version 11, which I can get away
with, but would also like to tell it to not use, just use version 10.
I have looked in references, in the ActiveX controls as well, and
nowhere can I find where it now needs to have a different version of
MAPI.
I realise MAPI is not actually part of either one of these softwares,
they are accessing it from the OS, so I even tried copying the MAPI
from my XP system onto the Win2K3 server, rebooted and still nothing.
Any help would be VERY appreciated. Thanks all.
Here is the code:
' Set up DAO objects (uses existing "tblCESPTasks" table)
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tblCESPTasks")
' Set up Outlook objects.
Dim ol As New Outlook.Application
Dim olns As Outlook.NameSpace
Dim cf As Outlook.MAPIFolder
Dim c As Outlook.TaskItem
Dim objItems As Outlook.Items
Dim prop As Outlook.UserProperty
Dim iNumContacts As Integer
Dim i As Integer
' Removes any tasks currently in tblCESPTasks
CleanTasks
Set olns = ol.GetNamespace("MAPI") ******************
Set cf = olns.GetDefaultFolder(olFolderTasks)
Set objItems = cf.Items
iNumContacts = objItems.Count
If iNumContacts <> 0 Then
For i = 1 To iNumContacts
If TypeName(objItems(i)) = "TaskItem" Then
Set c = objItems(i)
rst.AddNew
folder. In the following snippet of code you will see that Access is
trying to connect to Outlook to import the tasks for analysis. The
original code was written in Access 2002, on a Win2K3 server. I had
to copy the database onto my laptop so that I could work on it off
site. My laptop has Office 2003 on Windows XP Pro. After I worked on
the database (without affecting any coding, I was working on the
reports and the switchboard), it will no longer work in Access 2002.
The file format is still Access 2000. The line of code that
generates the error is marked with stars after it. It seems it does
not like the version of MAPI on the original machine. I do not have
any choice, the client needs it on 2002 and no changes to any DLL's is
allowed, due to it being a secure environment. Their IT department
would have a fit it I suggested having to load other DLL's onto their
machines.
My question is, how do I re-point the database to the 2002 version of
MAPI, not the 2003. I had the same issue with using Outlook 2003 and
had to drop in the Outlook library version 11, which I can get away
with, but would also like to tell it to not use, just use version 10.
I have looked in references, in the ActiveX controls as well, and
nowhere can I find where it now needs to have a different version of
MAPI.
I realise MAPI is not actually part of either one of these softwares,
they are accessing it from the OS, so I even tried copying the MAPI
from my XP system onto the Win2K3 server, rebooted and still nothing.
Any help would be VERY appreciated. Thanks all.
Here is the code:
' Set up DAO objects (uses existing "tblCESPTasks" table)
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tblCESPTasks")
' Set up Outlook objects.
Dim ol As New Outlook.Application
Dim olns As Outlook.NameSpace
Dim cf As Outlook.MAPIFolder
Dim c As Outlook.TaskItem
Dim objItems As Outlook.Items
Dim prop As Outlook.UserProperty
Dim iNumContacts As Integer
Dim i As Integer
' Removes any tasks currently in tblCESPTasks
CleanTasks
Set olns = ol.GetNamespace("MAPI") ******************
Set cf = olns.GetDefaultFolder(olFolderTasks)
Set objItems = cf.Items
iNumContacts = objItems.Count
If iNumContacts <> 0 Then
For i = 1 To iNumContacts
If TypeName(objItems(i)) = "TaskItem" Then
Set c = objItems(i)
rst.AddNew