Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

BOF or EOF

Posted on 2006-11-03
8
Medium Priority
?
326 Views
Last Modified: 2006-11-18
Hello,

I have a small problem and would be grateful for some help.

     <% If  cint(Recblockblockunblockif_else.Fields.Item("worker_uid").Value) = cint(Session("pt_login_id"))
 AND  cint(Recblockblockunblockif_else.Fields.Item("blocker_id").Value) = cint(RecmostofDuser.Fields.Item("id_usr").Value) Then  %>
          <h1>free and open</h1><% Else %>this user is blocked <% End If %>

The above works  if  Recblockblockunblockif_else is not empty, but when it is empty I get a Either BOF or EOF is True error, what can I do to it to work if there is no record.

regards and thanks for any help

Kenny
0
Comment
Question by:thatelvis
  • 5
  • 3
8 Comments
 
LVL 16

Accepted Solution

by:
CWS (haripriya) earned 500 total points
ID: 17872170
First check whether the recordset is empty or not like this:


<%
If Recblockblockunblockif_else.EOF = false then

If  cint(Recblockblockunblockif_else.Fields.Item("worker_uid").Value) = cint(Session("pt_login_id"))
 AND  cint(Recblockblockunblockif_else.Fields.Item("blocker_id").Value) = cint(RecmostofDuser.Fields.Item("id_usr").Value) Then  %>
          <h1>free and open</h1><% Else %>this user is blocked
<%
End If
else
%>
<b>No record to display</b>
<%
End if
%>
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17873207
Cyberweb Thank you,
have a great weekend.

regards

Kenny
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17873380
Hi again, Sorry I jumped the gun a little



the code you helped me with below. I only want one else, where as if the recordset is not empty and has the two values then   <h1>free and open</h1><% Else %>this user is blocked , below you gave me 2 elses, how can I modift it to have only the one else. thanks again.

Kenny




<%
If Recblockblockunblockif_else.EOF = false then

If  cint(Recblockblockunblockif_else.Fields.Item("worker_uid").Value) = cint(Session("pt_login_id"))
 AND  cint(Recblockblockunblockif_else.Fields.Item("blocker_id").Value) = cint(RecmostofDuser.Fields.Item("id_usr").Value) Then  %>
          <h1>free and open</h1><% Else %>this user is blocked
<%
End If
else
%>
<b>No record to display</b>
<%
End if
%>
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 17873518
<%
If Recblockblockunblockif_else.EOF = false then

If  cint(Recblockblockunblockif_else.Fields.Item("worker_uid").Value) = cint(Session("pt_login_id"))
 AND  cint(Recblockblockunblockif_else.Fields.Item("blocker_id").Value) = cint(RecmostofDuser.Fields.Item("id_usr").Value) Then  %>
          <h1>free and open</h1><% Else %>this user is blocked
<%
End If
End if
%>


and thanks for points!
:-)
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17873578
wowa,

ok when the user is blocked this shows "this user is blocked", but when the user is not blocked it shows nothing where as it should show   <h1>the user is not blocked</h1>, I find this so confusing, sorry to be a bother if you have any ideas i would be grateful, I wish I had given more points for this and didnt mean to close it so soon.

<%
If Recblockblockunblockif_else.EOF = false then

If  cint(Recblockblockunblockif_else.Fields.Item("worker_uid").Value) = cint(Session("pt_login_id"))
 AND  cint(Recblockblockunblockif_else.Fields.Item("blocker_id").Value) = cint(RecmostofDuser.Fields.Item("id_usr").Value) Then  %>
          <h1>the user is not blocked</h1><% Else %>this user is blocked
<%
End If
End if
%>
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17873793
I have re asked this question in the forum as I needed to resolve this in a hurry, no offence , and thanks for your help.

Kenny

0
 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 17879129
hi kenny,

Sorry there is a delay in answering because of the time difference. When you are working, for me it is bed-time.
I think you would have already solved the problem.

My kind advice, first check the results carefully and then accept the answer.

Good Luck
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17879594
Thanks I totally understand , have a great week.

regarsd

Kenny
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

916 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