Solved

How to avoid BOF EOF error when there is no record in the database

Posted on 2011-03-16
6
677 Views
Last Modified: 2012-05-11
With the following line I retrieve the checkmark as a letter (ü) from my column named EIT:

<%If rs3.BOF and rs3.EOF then Response.Write "&nbsp;" Else response.write rs3.fields("EIT") End If%>

I would like to do the same when I use a checkbox, but it gives me the BOF EOF error. Could you please help me modify the code below so that the checkbox shows even when there is no record.
Thank you


<%
If Not rs3.EOF Then
  If rs3("EIT") = "ü" Then %>
     <input name="EIT" value="ü" checked type="checkbox">
  <% Else %>
     <input name="EIT" value="ü" type="checkbox">
  <% End IF
End IF
%>

Open in new window

0
Comment
Question by:baxtalo
  • 3
  • 2
6 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35151769
it's still the same code:
<%
If Not ( rs3.EOF and rs3.BOF) Then
  If rs3("EIT") = "ü" Then %>
     <input name="EIT" value="ü" checked type="checkbox">
  <% Else %>
     <input name="EIT" value="ü" type="checkbox">
  <% End IF
End IF
%>

Open in new window

0
 

Author Comment

by:baxtalo
ID: 35151853
It gives me this error message:

ADODB.Field error '80020009'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/EIT/00.asp, line 0

It would be nice if the error would be replaced by &nbsp; like in the case of my first line when there is no record.
 
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 35151986
are you sure you are not confusing the error to actually happen in some other place of the code?
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 10

Expert Comment

by:ALaRiva
ID: 35152316
That error is not related to the BOF/EOF directly. You have no current record.

Can you post the entire piece of code?
0
 

Author Comment

by:baxtalo
ID: 35154088
I was absolutely sure that the problem was caused by this peace of code. It was right at the end of the page, just before the submit button. Angellll, when you asked if I was sure, I just cut it out to see what happens. The error was still there, so I knew you were right. What else was on the page? A hidden field before the submit button:
<input type="hidden" name="ID" value="<%=rs3("ID")%>">
I replaced with the code below, and now the problem is fixed.
<input type="hidden" name="ID" value="<%If rs3.BOF and rs3.EOF then Response.Write "&nbsp;" Else response.write rs3.fields("ID") End If%>">
I'm sorry for the confusion. Angellll, I did this to you for the second time. Thanks for your patience with me and I hope you won't ignore my questions in the future.
0
 

Author Closing Comment

by:baxtalo
ID: 35154091
Thank you very much
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server views 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 Access…
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…

820 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