What is wrong with my code?

  • Thread starter Thread starter Al
  • Start date Start date
A

Al

The code below works on some computers and does not on others. all computers
are on the same net work. the code breaks on ".send" and gives me an error
message "user send error". I am using Access 2003 so are the others.
any idea?


Sub Mail_CDO(strTo As String, strFrom As String, strSubject As String,
strBody As String)


Dim iMsg As Object
Dim iConf As Object
Dim iBP
Dim iItem As Variant
Dim strEmail As String, strAttach As String, sql As String
Dim db As dao.Database
Dim rs As dao.Recordset


sql = "SELECT * FROM qryfrmEmail WHERE ProjCode ='" & strProjC & "'"
Debug.Print sql

Set db = CurrentDb
Set rs = db.OpenRecordset(sql, dbOpenDynaset)
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")



'to make sure that the emailing is configured correctely
With iConf.Fields
.Item(cdoSMTPServer) = "mail.mdanderson.org"
.Update
End With

With iMsg
Set .Configuration = iConf
.To = strTo
.From = """Drawing Review"" < " & Nz(strFrom) & " > & "
.Subject = Nz(strSubject)
.TextBody = Nz(strBody)
.send
End With
rs.Close
Set rs = Nothing
Set db = Nothing
Set iBP = Nothing
Set iMsg = Nothing
Set iConf = Nothing
End Sub
 
Make sure cdo is installed on those machines. The filename/path should be:

C:\Windows\system32\cdosys.dll
 
The file is there and it is also selected in the reference library. the exact
message that the user gets is:
"The 'sendusing' configuration value is invalid"
any idea?
thanks
Al
 
Back
Top