Solved

BOF or EOF

Posted on 2006-11-03
8
317 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 125 total points
Comment Utility
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
Comment Utility
Cyberweb Thank you,
have a great weekend.

regards

Kenny
0
 
LVL 1

Author Comment

by:thatelvis
Comment Utility
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
 
LVL 16

Expert Comment

by:CWS (haripriya)
Comment Utility
<%
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:thatelvis
Comment Utility
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
Comment Utility
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)
Comment Utility
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
Comment Utility
Thanks I totally understand , have a great week.

regarsd

Kenny
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
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…
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

744 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

17 Experts available now in Live!

Get 1:1 Help Now