DotNetDunce
Programmer
I am getting a type mismatch error when this reaches the last line of the sub. Can someone help me figure out why this doesn't work?
post_id is a numeric field.
Thanks in advance for your help!
post_id is a numeric field.
Thanks in advance for your help!
Code:
Sub Delete_Recs(post_id)
set rs2 = Server.CreateObject("ADODB.recordset")
sql2_abbs = "DELETE FROM Posts WHERE post_id = " & post_id
response.write sql2_abbs & "<br>"
rs2.open, sql2_abbs, conn
End Sub
Conn.Open
Set rs = Server.CreateObject("ADODB.Recordset")
sql_abbs = "SELECT * FROM posts"
rs.Open sql_abbs, conn
cnt=0
cnt2=0
Do while not rs.eof
'response.write (DateDiff("m", Now, rs("date")))
if DateDiff("m", Now, rs("date")) <=-6 then
cnt2=cnt2+1
Call Delete_Recs(rs("post_id"))
response.write "Records Deleted<br>" & cnt2 & "<br>"
else
cnt = cnt + 1
'response.write "<font color='blue'>Record not ready for deletion" & response.write(cnt) & "</font><br>"
end if
rs.movenext
loop
conn.close
%>