Jump to content
xisto Community
Sign in to follow this  
suicide1405241470

No Record Found Error

Recommended Posts

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.