Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail object error. Invalid use of Null: 'cstr'

Status
Not open for further replies.

rakishoner

Technical User
Aug 22, 2002
36
0
0
US
Any idea what would cause this in my code?

Thanks in advance.


============================================================
Microsoft VBScript runtime error '800a005e'

Invalid use of Null: 'cstr'
============================================================

For i = 1 to Request.Form("Topic").Count
set objMail = CreateObject("CDONTS.NewMail")
TempInterest = TempInterest & Request.Form("Topic").Item(i) & " "
DistribSQL = DistribSQL & " or CIInterests.InterestName = '" _
& Request.Form("Topic").Item(i) & "' "
set RSEmailResponses = conn.execute ("select * from CIInterests " _
& " where InterestName = '" & Request.Form("Topic").Item(i) & "'")
objnewMail.Send RSEmailResponses("RespondTo"),Request.Form("EmailAddress"),_
RSEmailResponses("MessageSubject"),cstr(RSEmailResponses("MessageText"))
set objmail = nothing
Next
 
check the following:

1. is RSEmailResponses("MessageText")
2. if RSEmailResponses("MessageText") is not null, have you tried assigning the value of cstr(RSEmailResponses("MessageText")) to a variable before passing it as a parameter?

inform me if this works. :)
 
Also, I have noticed occasional problems with the type conversion functions that sometimes magically fix themselves (ie I fiddle with the code for a while and can't remember what I have done). A cheap, quick, and nasty way to convert to string is just to concatenate an empty string to it:
dim myNumber, myStr
myNumber = 5
myStr = "" & 5


-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
I found the problem with the 'cstr' null problem. I had blank feilds in my db and it didn't want them to be null. But now that I have that taken care of I have a new problem.

Where objMail.Send RSEmailResponses("RespondTo"),Request...

If more code needed np.

============================================================
Microsoft VBScript runtime error '800a000d'

Type mismatch
============================================================

For i = 1 to Request.Form("Topic").Count
set objMail = CreateObject("CDONTS.NewMail")
TempInterest = TempInterest & Request.Form("Topic").Item(i) & " "
DistribSQL = DistribSQL & " or CIInterests.InterestName = '" _
& Request.Form("Topic").Item(i) & "' "
set RSEmailResponses = conn.execute ("select * from CIInterests " _
& " where InterestName = '" & Request.Form("Topic").Item(i) & "'")
objMail.Send RSEmailResponses("RespondTo"),Request.Form("EmailAddress"),_
RSEmailResponses("MessageSubject"),cstr(RSEmailResponses("MessageText"))

set objmail = nothing
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top