Problems with CDO

G

Guest

New here, and new to Access Programming.
I am trying to automate sending an email from my database to myself when
certain conditions are met.
After reading a lot of threads about automated email, I decided to try CDO.
I am using WinXP Pro and Access 2003
My code is as follows:

Private Sub Command72_Click()
Dim iMsg As Object
Dim iConf As Object
Dim iBP
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

With iMsg
Set .Configuration = iConf
.To = "my email address here"
.CC = ""
.BCC = ""
.From = "Captain Kirk"
.Subject = "Problem!"
.TextBody = "Beam me up Scotty!"
.send
End With

Set iBP = Nothing
Set iMsg = Nothing
Set iConf = Nothing

End Sub

When this runs, I get the error message:
The "SendUsing" configuration value is invalid.
What am I doing wrong?
 
R

Rick Brandt

Paul said:
New here, and new to Access Programming.
I am trying to automate sending an email from my database to myself
when certain conditions are met.
After reading a lot of threads about automated email, I decided to
try CDO. I am using WinXP Pro and Access 2003
My code is as follows:

Private Sub Command72_Click()
Dim iMsg As Object
Dim iConf As Object
Dim iBP
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

With iMsg
Set .Configuration = iConf
.To = "my email address here"
.CC = ""
.BCC = ""
.From = "Captain Kirk"
.Subject = "Problem!"
.TextBody = "Beam me up Scotty!"
.send
End With

Set iBP = Nothing
Set iMsg = Nothing
Set iConf = Nothing

End Sub

When this runs, I get the error message:
The "SendUsing" configuration value is invalid.
What am I doing wrong?

You create and destroy an iConf object, but you never set its properties.
Here's what mine looks like...

Set iCfg = CreateObject("CDO.Configuration")
With iCfg
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")
= 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "URL To MailBox"
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
.Fields.Update
End With
 
G

Guest

Thanks Rick,
I'm still having a little trouble, can't connect to the server.
I have someone working on that problem.
As soon as we get it, I'll post results.
 

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

Similar Threads

CDOSYS 1
Did not receive email via CDO.message 1
CDO Message 1
Macro email 4
What is wrong with my code? 4
Excel CDO 5
Can't send email from Excel with CDO 2
Sending e-mail using CDO 1

Top