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
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