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

runtime error '800a000d' - please help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I keep having a problem with the line:
total_years = total_years + (old_year - old_rookie)
The line has astericks above and below the line.

I substituted in total = total + (1972 - 1958) and it worked.

Ideas?
Thanks,
Chris

<%
mycount = 1
%>
<table border=&quot;1&quot;>
<%
'do while not testRS.EOF

strSQL2 = &quot;select b.player_id as PID, p.rookie_year as RY, b.year as Y, b.homeruns as H from batting b, player p &quot; & _
&quot; where p.rookie_year < 1997 and b.player_id = p.player_id and b.homeruns > 0 &quot; & _
&quot; order by b.player_id asc, b.year asc &quot;

'connect to the database to fetch data
old_player_id = &quot;zz&quot;
total_years = 0
total_players = 0
old_homeruns = 0
old_year = 0
old_rookie = 0
current_hr = 0
current_rookie = 0
current_year = 0
dim diff
Dim oConn2
Set oConn2 = Server.CreateObject(&quot;ADODB.Connection&quot;)
oConn2.open &quot;DSN=***;UID=****;PWD=***&quot;

set testRS2 = oConn2.execute(strSQL2)


do while not testRS2.EOF
for each oField in testRS2.Fields
current_hr = &quot;'&quot; & testRS2(&quot;H&quot;) & &quot;'&quot;
current_rookie = &quot;'&quot; & testRS2(&quot;RY&quot;) & &quot;'&quot;
current_year = &quot;'&quot; & testRS2(&quot;Y&quot;) & &quot;'&quot;

if &quot;'&quot; & testRS2(&quot;PID&quot;) & &quot;'&quot; <> old_player_id then
old_player_id = &quot;'&quot; & testRS2(&quot;PID&quot;) & &quot;'&quot;
'''''''''''''''''''''''''''''''''''''''''''''''''''
total_years = total_years + (old_year - old_rookie)
'''''''''''''''''''''''''''''''''''''''''''''''''''
total_players = total_players + 1
old_homeruns = current_hr
old_year = current_year
old_rookie = current_rookie
else
if (current_hr > old_homeruns) then
old_homeruns = current_hr
old_year = current_year
old_rookie = current_rookie
end if
end if
next

testRS2.MoveNext

loop%>
<tr>
<td>Number of years: </td>
<td><%Response.Write(round((total_years / total_players) * 100)/100)%></td>
</tr>

<%
oConn2.Close
Set oConn2 = Nothing
set testRS2 = Nothing
%>
</table>
 
Hey old_year and old_rookie are strings and u just cannot substract them. use the following ...


total_years = total_years + (clng(old_year) - clng(old_rookie) )

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top