Anthony1312002
02-09-2005, 03:23 PM
I'm trying using this script to show a popup box when a person selects an ID that is not in the database. The Javascript that you see in the else part of the script works just fine when put in the onload event of the page. The msgbox appears. But for some reason its not working if the recordset is eof. Any thoughts?
If isempty(Request.Form("btnSearch")) Then
sql = "SELECT ReviewID, FUNB_ID, Dept_ID, OrgName, FullNames, ReviewCity FROM tblEmployees "
Set recordset = Server.CreateObject("ADODB.Recordset")
Set recordset = Conn.Execute(sql)
Else
sql = "SELECT ReviewID, FUNB_ID, Dept_ID, OrgName, FullNames, ReviewCity FROM tblEmployees WHERE FUNB_ID = '" & SearchText & "'"
Set recordset = Server.CreateObject("ADODB.Recordset")
Set recordset = Conn.Execute(sql)
if recordset.eof then
recordset.close
Set recordset= Nothing
Response.write("<script type=""text/javascript"">alert(""What is the employee's ID Number? If unavailable enter N/A. Re-select your employee before filling out the rest of the form."");</script>")
Response.Redirect "StaffingReview.asp"
End If
End If
If isempty(Request.Form("btnSearch")) Then
sql = "SELECT ReviewID, FUNB_ID, Dept_ID, OrgName, FullNames, ReviewCity FROM tblEmployees "
Set recordset = Server.CreateObject("ADODB.Recordset")
Set recordset = Conn.Execute(sql)
Else
sql = "SELECT ReviewID, FUNB_ID, Dept_ID, OrgName, FullNames, ReviewCity FROM tblEmployees WHERE FUNB_ID = '" & SearchText & "'"
Set recordset = Server.CreateObject("ADODB.Recordset")
Set recordset = Conn.Execute(sql)
if recordset.eof then
recordset.close
Set recordset= Nothing
Response.write("<script type=""text/javascript"">alert(""What is the employee's ID Number? If unavailable enter N/A. Re-select your employee before filling out the rest of the form."");</script>")
Response.Redirect "StaffingReview.asp"
End If
End If