Solved

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

Posted on 2011-03-12
4
656 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now