• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 687
  • Last Modified:

How to avoid error 80020009 if there is no record in the table

When I have records in the database this code works fine:
<%If IsNull(rs2("Certified")) or rs2("Certified")="" Then %>No<%else%>Yes<%end if%>
If there are no records I get the error 80020009 message
I'm using classic ASP and the database is MS Access.
Can somebody please help?
Thank you
0
baxtalo
Asked:
baxtalo
  • 2
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you have to first test if rs2.eof and rs2.bof then , if both properties return true, there is no record in the recordset. ...
0
 
baxtaloAuthor Commented:
my page identifies the logged in user. If the logged in user's emp_id is present in the database there is no error message, regardless if the Certified field is checked or it's empty. But sometimes my page is visited by users whose emp_id is not in the database. This is when the error 80020009 message appears, and the rest of the page is not displayed.
I wonder if this can be avoided.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>If there are no records I get the error 80020009 message
that is exactly what I suggested with my first comment ...

<%
If rs2.EOF and rs2.BOF Then 
  %>New<% 
Else If IsNull(rs2("Certified")) or rs2("Certified")="" Then 
  %>No<%
else
  %>Yes<%
 end if 'else from Certified test
end if 'else from eof/bof test
%>

Open in new window

0
 
baxtaloAuthor Commented:
Perfect, thank you very much.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now