Solved

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

Posted on 2011-03-12
4
664 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
  • 2
  • 2
4 Comments
 
LVL 142

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 142

Accepted Solution

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

777 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