Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: What is wrong with my code?

Geek News

What is wrong with my code?
Al 12/12/2008 6:51:01 PM
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
Re: What is wrong with my code?
"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> 12/13/2008 8:50:17 PM
Make sure cdo is installed on those machines. The filename/path should be:

C:\Windows\system32\cdosys.dll
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Al" <Al[ at ]discussions.microsoft.com> wrote in message
news:7953BD1F-4C89-4C8B-9D84-5ADDBB205F43[ at ]microsoft.com...
[Quoted Text]
> 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


Re: What is wrong with my code?
Al 12/15/2008 4:28:23 PM
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

"Arvin Meyer [MVP]" wrote:

[Quoted Text]
> Make sure cdo is installed on those machines. The filename/path should be:
>
> C:\Windows\system32\cdosys.dll
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
> "Al" <Al[ at ]discussions.microsoft.com> wrote in message
> news:7953BD1F-4C89-4C8B-9D84-5ADDBB205F43[ at ]microsoft.com...
> > 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
>
>
>
Re: What is wrong with my code?
"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> 12/17/2008 2:47:45 AM
That most likely is referring to a misconfiguration of CDO. That's beyond
the scope of this newsgroup, not in my area of expertise. If you don't have
an IT person on hand, perhaps you can get help in one of the newsgroups for
the version of Windows you are using.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Al" <Al[ at ]discussions.microsoft.com> wrote in message
news:AE4B8D63-6B22-4650-81E1-9F7AC99378DA[ at ]microsoft.com...
[Quoted Text]
> 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
>
> "Arvin Meyer [MVP]" wrote:
>
>> Make sure cdo is installed on those machines. The filename/path should
>> be:
>>
>> C:\Windows\system32\cdosys.dll
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>> "Al" <Al[ at ]discussions.microsoft.com> wrote in message
>> news:7953BD1F-4C89-4C8B-9D84-5ADDBB205F43[ at ]microsoft.com...
>> > 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
>>
>>
>>


Re: What is wrong with my code?
Al 12/17/2008 3:41:04 PM
Thanks Arvin. I will check with the IT on my end.

"Arvin Meyer [MVP]" wrote:

[Quoted Text]
> That most likely is referring to a misconfiguration of CDO. That's beyond
> the scope of this newsgroup, not in my area of expertise. If you don't have
> an IT person on hand, perhaps you can get help in one of the newsgroups for
> the version of Windows you are using.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
> "Al" <Al[ at ]discussions.microsoft.com> wrote in message
> news:AE4B8D63-6B22-4650-81E1-9F7AC99378DA[ at ]microsoft.com...
> > 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
> >
> > "Arvin Meyer [MVP]" wrote:
> >
> >> Make sure cdo is installed on those machines. The filename/path should
> >> be:
> >>
> >> C:\Windows\system32\cdosys.dll
> >> --
> >> Arvin Meyer, MCP, MVP
> >> http://www.datastrat.com
> >> http://www.mvps.org/access
> >> http://www.accessmvp.com
> >>
> >> "Al" <Al[ at ]discussions.microsoft.com> wrote in message
> >> news:7953BD1F-4C89-4C8B-9D84-5ADDBB205F43[ at ]microsoft.com...
> >> > 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
> >>
> >>
> >>
>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net