CDONTS email error

  • Thread starter Thread starter Philip Morgan
  • Start date Start date
P

Philip Morgan

I am trying to send a CDONTS email from an Access page using the code
provided below. The code works fine from a server ASP page (hence, we
have the necessary ActiveX and other add-in's).

The following error pops up when the code is launched:
"Run-time error '429'"
"ActiveX component can't create object"
and highlights the "User.Send" line in the code.

'******* CODE START *******
Option Compare Database
Option Explicit
Dim userMail
Private Sub cmdEmailTest_Click()
Set userMail = CreateObject("CDONTS.NewMail")
userMail.To = "(e-mail address removed)"
userMail.From = "(e-mail address removed)"
userMail.Subject = "test"
userMail.Body = "test"
userMail.Send
Set userMail = Nothing
End Sub
'******* CODE END *******

Others have posted solution code with "Server" prefixing the
"CreateObject" (for ASP pages).This results in a "Variable Not Found"
error on the "server".

I have also tried relocating the Access .mdb file from my C:/drive, to
a mapped server.

Any assistance would be greatly appreciated.

Thanks!

Phil Morgan
 
Hi Alex:

Thanks for considering my problem. My working code runs from the
server side in an ASP page, so I know our servers are SMTP enabled.

If a lack of SMTP enabling at the PC level is the problem, how do I
get around this issue. Do I call an ASP page to run at the server
level from within Access - seems a bit round about - surely, there has
got to be another way that this newbie mind hasn't thought of.

Any suggestions ( and working code!) would be greatly appreciated.

Phil Morgan
 
Additional information...

I've tried (a) removing the Option Explicit and Database Compare
dimensions, (b) adding Server as a dimension, (c) moving the mdb to
another server and (d) lots of combinations of the above.

I even tested the code behind an ASP page - works great there. Why can
IE/ASP locate the server and Access can't?

Several of my attempts to declare/identify the SMTP server in Access
have been unsuccessful.

Still looking for a solution.... if you have one please let me know
(the lump on my forehead from banging my head on the desk is beginning
to scare my co-workers).

Thanks.

Phil Morgan
 
Hi Philip,
just tried your code on windows 2000/access xp - works fine. what operation
system you have?
 
Hi Alex:

Our system at work is NT.... the code and CDONTS work fine at the
server level. It may also work fine at the client/PC level.. but we'll
never know because the local SMTP server apparently is not connected
to the Exchange server... the "Send" of the code crashes.

Thanks for thinking about this problem...

Phil Morgan

P.S. If you are using XP, don't you have to modify the code to CDOSYS?
Ahhh... not important..
 
Back
Top