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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with this script!!!!!

Status
Not open for further replies.

blaises

Technical User
Sep 29, 2003
9
GB
Hi all,

Am working on a script ( see below ) that is suppose to look up a date field in a database and notify me when the date has expired or expiring. Everytime I run the script, I get the following error msg. Some body help me out here!:


Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'to'
/realsql/TMPc42ocpzvof.asp, line 36

Line 36 contains the following code: "objEmail.to = Email"


(This is the rest of the code)

<%@ language=&quot;vbscript&quot; %>
<% option explicit %>
<!-- #include file=&quot;utilitis.asp&quot; -->
<%


dim strSQL

strSQL = &quot;SELECT * FROM content WHERE expire<='&quot; & date() & &quot;'&quot; ' ----

dim objup
set objup = server.createobject(&quot;ADODB.RecordSet&quot;)
rs.open strSQL, cn, 1, 3

dim objEmail

dim count
dim people
dim email
count =0

dim message
email = rs(&quot;Email&quot;)

do while not rs.EOF

message = &quot;the following document is due to be reviewed -- &quot; & rs(&quot;title&quot;) & &quot;-- This reminder was brought to you by
Set objEmail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
objEmail.to = Email
objEmail.bcc = &quot;jasper@mail.co.uk&quot;
objEmail.From = &quot;Cliniweb<--->&quot;
objEmail.subject = &quot;You have a reminder! &quot; & date()
objEmail.body = message
objEmail.send
set objEmail = nothing

people = people & &quot;<br> &quot; & rs(&quot;author&quot;)
count = count + 1

rs.movenext
loop

response.write(&quot;<b>&quot; & count & &quot;</b> reminders were sent on &quot;& date() & &quot; to:<br> &quot;)
response.write(people)


set cn=nothing

%>
 
this line

/realsql/TMPc42ocpzvof.asp, line 36


tell me your previewing the page and not calling it (i.e.
try that and see if you still get the problem...


[sup]The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of the darkness. For he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee....
 
I get the same error message. Have just done it again to double check:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'to'
/realsql/remind1.asp, line 36

Any further suggestion?
 
I am having this problem:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
/test/aspTest2.asp, line 42

The code:
Code:
<%

Dim objConn
Set objConn = server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.ConnectionString = &quot;DSN=accweb&quot;
objConn.Open

ICITEMsql = &quot;Select ICITEM.*, ICILOC.* from ICITEM, ICILOC WHERE ICITEM.ITEMNO = ICILOC.ITEMNO AND (ICILOC.QTYONHAND + ICILOC.QTYONORDER - ICILOC.QTYSALORDR) > 0&quot;

set rstemp=objConn.Execute(ICITEMsql)

%>
<table width=&quot;526&quot; border=&quot;1&quot;>
<tr> 
<td width=&quot;66&quot; nowrap>
<div align=&quot;center&quot;><strong>ITEM NUMBER</strong></div></td>
    <td width=&quot;224&quot; nowrap>
<div align=&quot;center&quot;><strong>DESCRIPTION</strong></div></td>
    <td width=&quot;111&quot; nowrap>
<div align=&quot;center&quot;><strong>HECI/CLEI</strong></div></td>
    <td width=&quot;28&quot; nowrap>
<div align=&quot;center&quot;><strong>MANUFACTURER</strong></div></td>
    <td width=&quot;28&quot; nowrap>
<div align=&quot;center&quot;><strong>CATEGORY</strong></div></td>
    <td width=&quot;29&quot; nowrap> 
<div align=&quot;center&quot;><strong>TOTAL QTY</strong></div></td>
</tr>

<%DO UNTIL rstemp.eof %>
  <tr> 
    <td valign=&quot;top&quot;><%=rstemp(&quot;ITEMNO&quot;)%></td>
    <td valign=&quot;top&quot;><%=rstemp(&quot;DESC&quot;)%></td>
    <td valign=&quot;top&quot;><%=rstemp(&quot;OPTFLD6&quot;)%></td>
    <td valign=&quot;top&quot;><%=rstemp(&quot;OPTFLD3&quot;)%></td>
    <td valign=&quot;top&quot;><%=rstemp(&quot;CATEGORY&quot;)%></td>
    <td valign=&quot;top&quot;>

<********************* Problem Starts Here*********************>

<%
totalquantity = rstemp(&quot;QTYONHAND&quot;) + rstemp(&quot;QTYONORDER&quot;) -rstemp(&quot;QTYSALORDR&quot;)
response.Write(totalquantity)			
%>

<******************************************************>

</td>
</tr>
<%
rstemp.movenext
LOOP
%>
</table>

<%
rstemp.close
set rstemp=nothing
objConn.Close
set objConn=nothing
%>
 
telexpress
please don't post problems in other threads. try starting a new one pertaining to your specific problem. When posting direct us to the line that the error is related to. we don;t know what line 42 is in the while of things.
explicitly bolding the line is a good idea or how you did the *** around it. :) but there are two lines there.



all,
have either tested the values that are being taken form the DB? repsonse.write them to the screen and such? type mismatch errors don't leave much options around for what is wrong. the value may be a string but you think it's a numeric per say.

blaises
Have you validated that the variable &quot;Email&quot; is valid?
If the To field is not a valid email in CDONTS it may give a type mismatch error. have you tested the mail to be working witha test run on a hard coded value for &quot;all&quot; the needed object parameters.

_____________________________________________________________________
onpnt2.gif
[sub]
Hakuna matata!!
[/sub]
 
Thanks Onpnt,

You were right, for some reason I thought I had values in all the email field...but I didn't. It appears to to be fine now.

Many thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top