?
Solved

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

Posted on 2011-03-12
4
Medium Priority
?
675 Views
Last Modified: 2012-06-21
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
Comment
Question by:baxtalo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35118799
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
 

Author Comment

by:baxtalo
ID: 35118918
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
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 35118943
>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
 

Author Closing Comment

by:baxtalo
ID: 35118968
Perfect, thank you very much.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question