A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

URGENT!!! - MAPI Issues with vesion changes of Outlook and Access



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 30th 07, 05:18 PM posted to comp.databases.ms-access,microsoft.public.outlook.program_vba
The Facilitator
external usenet poster
 
Posts: 12
Default URGENT!!! - MAPI Issues with vesion changes of Outlook and Access

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
Ads
  #2  
Old March 30th 07, 07:04 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default URGENT!!! - MAPI Issues with vesion changes of Outlook and Access

Don't get hung up on MAPI, this isn't a MAPI issue! Nor do I think it's
related to the version of Access you are using or what version of Windows you
are working on or targeting. What's really critical is the error number and
description the GetNamespace call generates. AFAIR, that may occur if
Outlook hasn't finished loading yet.

Also, if you need to have this database run on computers that may have
earlier versions of Outlook, you need to set a reference to the Type Library
of the earliest Outlook version you need to support. Alternatively, use
late-binding and declare all your Outlook objects as Object.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"The Facilitator" wrote:

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

  #3  
Old March 30th 07, 08:19 PM posted to comp.databases.ms-access,microsoft.public.outlook.program_vba
Mark Reed
external usenet poster
 
Posts: 1
Default URGENT!!! - MAPI Issues with vesion changes of Outlook and Access

This is not because your references are wrong is it?

From the visual basic editor, click on Tools - References and make sure you
have a reference to Microsoft Outlook (version number) Object library.

The versions change between each version of office!!!!.

Mark



"The Facilitator" wrote in message
...
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



  #4  
Old March 30th 07, 09:37 PM posted to comp.databases.ms-access,microsoft.public.outlook.program_vba
The Facilitator
external usenet poster
 
Posts: 12
Default URGENT!!! - MAPI Issues with vesion changes of Outlook and Access

This happened once I clicked on the import function on my laptop
accidentally. Once I did that, Access would no longer accept the
v10.0 of the Outlook objects. That's why I went to the v11.0. After
that it worked fine for about a day. No matter what I tried, it would
not accept the v 10.0 , but it worked with v 11.0, even in the
Win2K3/Off2K2 environment.

Just as I was about to hand it over to the client, it came up with
"Error in loading DLL", which I traced back to the import component. I
put on a breakpoint just before the function runs and it stops at the
line

Set olns = ol.GetNamespace("MAPI")

and the error I get from within the module area is also Error in
loading DLL. I debug and it highlights that specific line.

On my laptop (with XP/2K3) it still runs just fine. When I load up
Office 2K3 onto the server, it runs fine.

Could it be that there is some v 11 code in the custom form that I
created for Outlook? I am not understanding how this could be, if I
designed it in 2K2, and it ran just fine in 2K2. I didn't add
anything to the form from 2K3.

I've also had the opportunity to test it out on another machine that
had Win2K/Off2K2 and it dod not work either. On this one I tried to
copy over the appropriate MAPI dll's into the Windows folder and I
rebooted. Still no luck.

I've done my best to isolate the problem and it does point to the MAPI
dll. Or at least it points to a dll that is being called when it
tries to get the MAPI namespace.

I've gone over the code to all the apps in this form and nothing is
amiss. I made sure that the code is the same in both machines. I've
done everything I can think of.

I hope this lengthy explanation helps someone see where my problem is.

Thank you for your help so far, and for any further help.

O

On Fri, 30 Mar 2007 20:19:29 +0100, "Mark Reed"
wrote:

This is not because your references are wrong is it?

From the visual basic editor, click on Tools - References and make sure you
have a reference to Microsoft Outlook (version number) Object library.

The versions change between each version of office!!!!.

Mark



"The Facilitator" wrote in message
.. .
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


  #5  
Old March 30th 07, 09:46 PM posted to comp.databases.ms-access,microsoft.public.outlook.program_vba
Tim Marshall
external usenet poster
 
Posts: 1
Default URGENT!!! - MAPI Issues with vesion changes of Outlook and Access

The Facilitator wrote:

When I load up
Office 2K3 onto the server, it runs fine.


Oh dear, O, you might get some flak for that. Unless some of the big
guns here can tell me why I'm wrong, I'd never recommend having A2003 on
a server...

Note that I haven't followed this thread - this just caught my eye as I
was skimming through posts...
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
  #6  
Old March 30th 07, 09:50 PM posted to microsoft.public.outlook.program_vba
The Facilitator
external usenet poster
 
Posts: 12
Default URGENT!!! - MAPI Issues with vesion changes of Outlook and Access

There are only a few tasks in the Outlook mailbox, as it is only a
test environment. I have left it open so that there would be no lag.
It also does not GET to Outlook as whenever it did beforehands, it
would come up with the program accessing Outlook warning. The
following is the error information from the help file of the Access
2K2.

------------------------------------------------------------------------------------
Error in loading DLL (Error 48)


A dynamic link library (DLL) is a library specified in the Lib clause
of a Declare statement. This error has the following causes and
solutions:

The file isn't DLL-executable.
If the file is a source-text file, it must be compiled and linked to
DLL executable form.

The file isn't a Microsoft Windows DLL.
Obtain the Microsoft Windows DLL equivalent of the file.

The file is an early Microsoft Windows DLL that is incompatible with
Microsoft Windows protect mode.
Obtain an updated version of the DLL. ***************************

The DLL references another DLL that isn't present.
Obtain the referenced DLL and make it available to the other DLL.

The DLL or one of the referenced DLLs isn't in a directory specified
by your path.
Move the DLL to a referenced directory or place its current directory
on the path.

For additional information, select the item in question and press F1
(in Windows) or HELP (on the Macintosh).

--------------------------------------------------------------------------------------

The line with the stars after it, is what I am assuming is the problem
from this error. I have no non-M$ DLL's, no DLL's that I know of were
removed from the system, I never set anything in a Path statement in
the first place. This leaves incompatible version.

Needless to say, it was not the best of presentations to the client.

Thank you for the help so far, and any further help I receive.

O


On Fri, 30 Mar 2007 11:04:01 -0700, Eric Legault [MVP - Outlook]
wrote:

Don't get hung up on MAPI, this isn't a MAPI issue! Nor do I think it's
related to the version of Access you are using or what version of Windows you
are working on or targeting. What's really critical is the error number and
description the GetNamespace call generates. AFAIR, that may occur if
Outlook hasn't finished loading yet.

Also, if you need to have this database run on computers that may have
earlier versions of Outlook, you need to set a reference to the Type Library
of the earliest Outlook version you need to support. Alternatively, use
late-binding and declare all your Outlook objects as Object.

  #7  
Old March 31st 07, 06:55 PM posted to comp.databases.ms-access,microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default URGENT!!! - MAPI Issues with vesion changes of Outlook and Access

Import what?

This code is in Outlook VBA code?

The MAPI libraries are installed by Outlook, Simple MAPI can be installed by
Outlook Express, Eudora installs a version of MAPI, the term MAPI is rather
general. In this case it's Outlook MAPI that has to be dealt with. It's
always a good idea to make sure that Outlook is the default mail handler and
that it's installed correctly. So open IE, on Programs tab make sure Outlook
is the mail handler. Then run a Detect and Repair on your Office
installation.

Outlook MAPI is very version specific. So if you are developing in Access
2002 you will want to run an Office 2002 environment. If you develop on 2003
you must make sure you aren't using any methods, properties or events that
aren't in the earlier version. After you port back to the older environment
you must also make sure the project references are set correctly.

Never, ever run Outlook 2003 on an Exchange server. Do not do it. Outlook
2007 is OK for that. Earlier versions will corrupt the MAPI on the server
unless you really know what you're doing.

Instantiating a MAPI session failing like that has nothing to do with
pointing towards a certain version of MAPI. The high level connection you
are using with MAPI just depends on what version is registered and the
default MAPI handler. You aren't using a LoadDLL type thing and trying to
execute Extended MAPI functions like HrGetOneProp directly.

I've taken Outlook and Access applications back and forth among versions and
the best practice is really to develop in the earliest environment you need
to support. I use VM's with every Outlook/Office environment I need to
support so I can develop on any of them as needed. Usually I program
(addins) on an Office 2003 machine and compile on an Office 2000 VM. I'm
always adjusting project references and such, but you do need that earlier
environment available to be able to do that.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"The Facilitator" wrote in message
...
This happened once I clicked on the import function on my laptop
accidentally. Once I did that, Access would no longer accept the
v10.0 of the Outlook objects. That's why I went to the v11.0. After
that it worked fine for about a day. No matter what I tried, it would
not accept the v 10.0 , but it worked with v 11.0, even in the
Win2K3/Off2K2 environment.

Just as I was about to hand it over to the client, it came up with
"Error in loading DLL", which I traced back to the import component. I
put on a breakpoint just before the function runs and it stops at the
line

Set olns = ol.GetNamespace("MAPI")

and the error I get from within the module area is also Error in
loading DLL. I debug and it highlights that specific line.

On my laptop (with XP/2K3) it still runs just fine. When I load up
Office 2K3 onto the server, it runs fine.

Could it be that there is some v 11 code in the custom form that I
created for Outlook? I am not understanding how this could be, if I
designed it in 2K2, and it ran just fine in 2K2. I didn't add
anything to the form from 2K3.

I've also had the opportunity to test it out on another machine that
had Win2K/Off2K2 and it dod not work either. On this one I tried to
copy over the appropriate MAPI dll's into the Windows folder and I
rebooted. Still no luck.

I've done my best to isolate the problem and it does point to the MAPI
dll. Or at least it points to a dll that is being called when it
tries to get the MAPI namespace.

I've gone over the code to all the apps in this form and nothing is
amiss. I made sure that the code is the same in both machines. I've
done everything I can think of.

I hope this lengthy explanation helps someone see where my problem is.

Thank you for your help so far, and for any further help.

O


  #8  
Old March 31st 07, 06:56 PM posted to comp.databases.ms-access,microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default URGENT!!! - MAPI Issues with vesion changes of Outlook and Access

It's installing Outlook on an Exchange server that's verboten.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Tim Marshall" wrote in message
...
The Facilitator wrote:

When I load up
Office 2K3 onto the server, it runs fine.


Oh dear, O, you might get some flak for that. Unless some of the big guns
here can tell me why I'm wrong, I'd never recommend having A2003 on a
server...

Note that I haven't followed this thread - this just caught my eye as I
was skimming through posts...
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me


  #9  
Old March 31st 07, 11:43 PM posted to comp.databases.ms-access,microsoft.public.outlook.program_vba
lyle fairfield
external usenet poster
 
Posts: 1
Default URGENT!!! - MAPI Issues with vesion changes of Outlook and Access

"Ken Slovak - [MVP - Outlook]" wrote in
:

Never, ever run Outlook snips of other stuff which I shouldn't have
left out ...


Great advice!

--
lyle fairfield

Ceterum censeo Redmond esse delendam.
  #10  
Old April 1st 07, 02:37 AM posted to comp.databases.ms-access,microsoft.public.outlook.program_vba
Larry Linson
external usenet poster
 
Posts: 1
Default URGENT!!! - MAPI Issues with vesion changes of Outlook and Access

"lyle fairfield" wrote in message
news
"Ken Slovak - [MVP - Outlook]" wrote in
:

Never, ever run Outlook snips of other stuff which I shouldn't have
left out ...


Great advice!


Lyle, you are one of a kind! :-)

Larry


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help on Outlook 2007 ( URGENT ) Edward Outlook - General Queries 7 January 16th 07 04:46 PM
Experts Challenge: MAPI is unable to access Public Folder store items [email protected] Outlook - General Queries 9 October 27th 06 12:54 PM
Urgent Trés Urgent! Alain Philibin Outlook Express 7 September 28th 06 08:43 AM
remote access exchange / synch issues pt_tony Outlook - Installation 3 January 19th 06 03:48 PM
Urgent-help-outlook Medo_in_Egypt Outlook - Installation 3 January 15th 06 07:49 PM


All times are GMT +1. The time now is 04:14 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.