all groups > iis smtp nntp > december 2004 >
You're in the

iis smtp nntp

group:

Problem with cdo.dll/cdosys.dll


Problem with cdo.dll/cdosys.dll Neil Ginsberg
12/10/2004 2:41:49 AM
iis smtp nntp:
I am using VBA/Access to send SMTP mail using CDO. I set a reference to
"Microsoft CDO for Windows 2000 Library" (cdosys.dll). Everything works
fine, both on my PC and on another PC. However, on another PC that the
database was installed on, the user is getting the message, "The project
contains a missing or broken reference to the file 'CDO.DLL' version 1.21."
However, I don't have a reference to cdo.dll; my reference is to cdosys.dll.
The user has cdosys.dll, but doesn't have cdo.dll.

Any ideas as to what's going on?

Thanks!

Neil

Re: Problem with cdo.dll/cdosys.dll Egbert Nierop (MVP for IIS)
12/10/2004 7:54:32 AM
[quoted text, click to view]

Try
regsvr32 cdosys.dll
b.t.w. is the cdosys.dll exactly the same on both machines?

[quoted text, click to view]
Re: Problem with cdo.dll/cdosys.dll Rick Brandt
12/10/2004 2:14:12 PM
[quoted text, click to view]

You would be better off switching to late binding which doesn't require
that you set a reference at all. This offers the following benefits.

In most cases the code becomes version independent. If you ask Windows to
create an object (for example) of "CDO.Message" then any registered library
capable of creating that object can be used.

In cases where no appropriate library exists in an application with a hard
reference you not only get an error when attempting to use that library,
but the reference marked "MISSING" will cause many built in Access
functions to fail. So for lack of an Email library, the whole app might be
rendered useless. With late binding, a PC that lacks an appropriate
library ONLY loses the abilities that the missing library provides. The
rest of the app still works just fine.


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Re: Problem with cdo.dll/cdosys.dll Neil Ginsberg
12/10/2004 7:25:01 PM
I just got some more information on this, and it's pretty interesting.

On my machine (development), I used "Microsoft CDO for Windows 2000 Library"
(cdosys.dll). Works fine.

The client using the db is in an office that uses Microsoft Exchange. On his
PC (in which there is no error and the code works fine), under references it
says, "Microsoft CDO for Microsoft Exchange" (cdoex.dll).

Now, when I delivered the database, the reference was to cdosys.dll. But
when he used it, somehow the reference got changed to cdoex.dll, though he
didn't do anything.

So does Windows just pick which is the best cdo dll to use, based on the
configuration? Since they're using Exchange, did it just replace the
reference to cdosys.dll with cdoex.dll? Seems kind of strange.

Anyway, getting back to the problem PC. Another PC on his LAN is the one
getting the error message. When we opened it up and looked at References, it
had two things: first was the reference to cdoex.dll, as was on the other
one; and the second was a reference to "Microsoft CDO Version 1.21"
(cdo.dll), which was indicated as "Missing."

So this PC not only changed cdosys.dll to cdoex.dll (as on the other PC),
but it also added a broken reference to cdo.dll. We removed the reference to
cdo.dll, and everything worked fine.

So, any idea as to what's going on, why these references are being swapped
out, and where the broken reference to cdo.dll came from?

Thanks!

Neil


"Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
message news:%23en13Vo3EHA.2288@TK2MSFTNGP11.phx.gbl...
[quoted text, click to view]

Re: Problem with cdo.dll/cdosys.dll Rick Brandt
12/10/2004 8:26:49 PM

[quoted text, click to view]

No, you do have to make some minor modifications to the code. Instead of...

Dim CDOMsg as CDO.Message
Set CDOMsg = New CDO.Message

....you use...

Dim CDOMsg as Object
Set CDOMsg = CreateObject("CDO.Message")

You also can't use named constants that are defined in the external library, but
instead have to substitute the literal value.

I usually add the reference to create the procedure so I can use the code
completion features of Access and after debugging, make the switch to late
binding.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



Re: Problem with cdo.dll/cdosys.dll Neil Ginsberg
12/11/2004 12:58:01 AM
One good thing about setting references is that it allows you specify an
order -- as with ADO and DAO -- with the first one being the default.

Anyway, so you're saying that if I omit the reference to CDO and just keep
the rest of the code the same, that it will automatically use the library,
as long as it's registered?

Neil


[quoted text, click to view]

Re: Problem with cdo.dll/cdosys.dll Egbert Nierop (MVP for IIS)
12/12/2004 1:55:22 PM
[quoted text, click to view]

Surprise!
inside global.asa you can add a meta tag

<!--METADATA TYPE="TypeLib"
uuid={CD000000-8B95-11D1-82DB-00C04FB1625D}
-->

And now you have your constants imported.

[quoted text, click to view]
Re: Problem with cdo.dll/cdosys.dll Neil Ginsberg
12/13/2004 9:42:38 AM
Yes; but in this case we're talking about different dlls altogether:
cdosys.dll being replaced with cdoex.dll in the application; and (in one
case) a broken reference to cdo.dll that I didn't place there!

Neil

[quoted text, click to view]

Re: Problem with cdo.dll/cdosys.dll david epsom dot com dot au
12/13/2004 12:44:22 PM
VB/VBA will, under some circumstances, attempt to correct your
filename and version references: if you reference mydll ver 1.1.1
in your application folder, and on the target machine mydll
ver 1.1.2 is registered instead, and is in the Win Sys folder,
your application might attempt to use it. The critical link is
the GUID used to identify the object in the registry.

For example, if you try to load both Access 2002 and Access 2003,
you might find that you have actually loaded the A2003 version
or A2002 version of some file.

It often seems to cause problems: perhaps because we only notice
it when it has caused a problem.

(david)



[quoted text, click to view]

Re: Problem with cdo.dll/cdosys.dll david epsom dot com dot au
12/14/2004 10:06:29 AM
Have you checked the GUID values for those objects? I understand
the importance which you place on filenames, but that is not
actually how the system was intended to work.

(david)

[quoted text, click to view]

AddThis Social Bookmark Button