suicide1405241470 0 Report post Posted September 10, 2004 I am trying to run the following asp function:code:--------------------------------------------------------------------------------Private Function GetAbs(dThisDate, lPartID) sql_abs = "SELECT AbsCode FROM Absence WHERE AbsDate = '" & dThisDate & "' AND PartID = " & lPartID Set rs_abs = conn.Execute(sql_abs) GetAbs = rs_abs(0).Value Set rs_abs = NothingEnd Function--------------------------------------------------------------------------------It works fine if it finds a record but returns an error if it doesn't. How can I avoid this error?Thanks! Share this post Link to post Share on other sites
daf 0 Report post Posted September 10, 2004 I am trying to run the following asp function: code:-------------------------------------------------------------------------------- Private Function GetAbs(dThisDate, lPartID) sql_abs = "SELECT AbsCode FROM Absence WHERE AbsDate = '" & dThisDate & "' AND PartID = " & lPartID Set rs_abs = conn.Execute(sql_abs) GetAbs = rs_abs(0).Value Set rs_abs = Nothing End Function -------------------------------------------------------------------------------- It works fine if it finds a record but returns an error if it doesn't. How can I avoid this error? Thanks! <{POST_SNAPBACK}> i'm not good skilled in ASP, but i suppose you have to test first if rs_abs is empty before trying to get its value. Share this post Link to post Share on other sites
The Mortgage Man 0 Report post Posted September 15, 2004 i'm not good skilled in ASP, but i suppose you have to test first if rs_abs is empty before trying to get its value. <{POST_SNAPBACK}> Also you may want to try a nested sub-select with a WHERE EXISTS clause. js Share this post Link to post Share on other sites