Run-time error 458

M

Mark

I have a secured database runnning in Access 97 SR-2. I
have a form with some code that automatically generates an
email message in Outlook. It works fine on my computer.

The code starts off as follows

Dim wsCurrent As Workspace
Dim dbCurrent As Database
Dim qdfEmailAnnouncement As QueryDef
Dim rstEmailAnnouncement As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim strEmail As String

Set wsCurrent = DBEngine.Workspaces(0)
Set dbCurrent = wsCurrent.Databases(0)
Set qdfEmailAnnouncement = dbCurrent.QueryDefs
("qryNGSEmailDistribution")
Set rstEmailAnnouncement =
qdfEmailAnnouncement.OpenRecordset(dbOpenSnapshot)

rstEmailAnnouncement.MoveFirst

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

But at my clients location when I launch the code it
generates an error message saying:

"Run-time error 458. Variable uses an Automation type not
supported in Visual Basic."

When I use the "debug" button it hangs up on the following
line of code:

Set objOutlook = CreateObject("Outlook.Application")

I have already checked to make sure that they have the
same reference libraries as I do on my computer.

Any idea as to what could be the problem?

Thanks if you have an answer!

Mark Weiler
Ontario Canada
 
T

TC

Hi Mark

Was this a reply to my post? If so, please reply to >my< post, not >your<
post. That way, the conversation builds up over time. Understand that my
previous post could have disappeared from my newsserver. So, if you do not
include the text of that previous post (eg. by replying to it), I have to
remember what your problem was; and my memory ain't that good :)

Here's what I would try next.

(1) If there is more than one version of Outlook installed on the "bad" PCs,
try using Outlook.Application.x instead of Outlook.Application. Replace 'x'
with the version number of Outlook that you want to use. Perhaps
Outlook.Application.9 (for example).

(2) If that doesn't work, or there are >not< several versions of Outlook on
the bad PCs, I'd be tempted to deinstall Outlook, reinstall & try again.

(3) If nothing works, you may be able to fix it using so-called "late
binding". >Remove< the reference to the Outlook library(ies), and change
all: "As Outlook.whatever" definitions, to say: "As Object" instead. Late
binding is slower, however, & can be harder to debug.

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top