How to suppress "Either BOF or EOF is True" error

How to suppress "Either BOF or EOF is True" error

am 25.10.2005 04:11:23 von Kermit Piper

Hello, I have an edit form where the name is already populated. When
the user submits this form, it posts to a process email page which
loops through a separate lookup table. Sometimes the name from the form
will not match the name in the table, which is fine. We don't need to
update the name on the form.

If I don't do this...

if (objRS.BOF and objRS.EOF) then
response.write "No records found"
response.end
End if

.... I get this:

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

Is there any way to simply suppress this error and let the form just
update, even if there isn't a direct match between the name value from
the form and the name value in the database table?

Thanks in advance,
Bruce

Re: How to suppress "Either BOF or EOF is True" error

am 25.10.2005 05:01:33 von unknown

I'm not sure what code you want to run, but you don't have to have to put
anything in the condition where it's .EOF.


If Not objRS.EOF Then
'''your code here.

End If

Ray at work

"Kermit Piper" wrote in message
news:1130206283.822327.89660@g49g2000cwa.googlegroups.com...
> Hello, I have an edit form where the name is already populated. When
> the user submits this form, it posts to a process email page which
> loops through a separate lookup table. Sometimes the name from the form
> will not match the name in the table, which is fine. We don't need to
> update the name on the form.
>
> If I don't do this...
>
> if (objRS.BOF and objRS.EOF) then
> response.write "No records found"
> response.end
> End if
>
> ... I get this:
>
> Either BOF or EOF is True, or the current record has been deleted.
> Requested operation requires a current record.
>
> Is there any way to simply suppress this error and let the form just
> update, even if there isn't a direct match between the name value from
> the form and the name value in the database table?
>
> Thanks in advance,
> Bruce
>

Re: How to suppress "Either BOF or EOF is True" error

am 25.10.2005 18:46:02 von Kermit Piper

If I do what yo suggest, and don't put any response between the
If...End If, I still get this error:
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.

I need to just suppress the error or handle it so it falls through and
continues processing.

Re: How to suppress "Either BOF or EOF is True" error

am 25.10.2005 19:39:25 von unknown

No, you don't need to supress the error. You need to not cause errors.

If not yourRS.EOF then
your code that uses yourRS here. NOT outside of this if/then block!
End If

Ray at work

"Kermit Piper" wrote in message
news:1130258762.549049.235620@g44g2000cwa.googlegroups.com.. .
> If I do what yo suggest, and don't put any response between the
> If...End If, I still get this error:
> Either BOF or EOF is True, or the current record has been deleted.
> Requested operation requires a current record.
>
> I need to just suppress the error or handle it so it falls through and
> continues processing.
>

Re: How to suppress "Either BOF or EOF is True" error

am 25.10.2005 19:39:48 von Mark Schupp

Are you trying to fill in data in the form from the database? You can only
use the recordset if a row is found.

If Not rs.EOF Then
'get data from recordset
End If
rs.Close

'now fill in the form fields


--
--Mark Schupp


"Kermit Piper" wrote in message
news:1130258762.549049.235620@g44g2000cwa.googlegroups.com.. .
> If I do what yo suggest, and don't put any response between the
> If...End If, I still get this error:
> Either BOF or EOF is True, or the current record has been deleted.
> Requested operation requires a current record.
>
> I need to just suppress the error or handle it so it falls through and
> continues processing.
>

Re: How to suppress "Either BOF or EOF is True" error

am 26.10.2005 09:42:28 von Roland Hall

"Kermit Piper" wrote in message
news:1130258762.549049.235620@g44g2000cwa.googlegroups.com.. .
: If I do what yo suggest, and don't put any response between the
: If...End If, I still get this error:
: Either BOF or EOF is True, or the current record has been deleted.
: Requested operation requires a current record.
:
: I need to just suppress the error or handle it so it falls through and
: continues processing.

if not (rs.BOF or rs.EOF) then
' records returned
else
' no records returned
end if

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Re: How to suppress "Either BOF or EOF is True" error

am 27.10.2005 20:37:13 von Kermit Piper

What I didn't explain earlier, is that below this code I have a CDONTS
process which is dependent upon the recordset not failing:

<%
objRS.MoveFirst
Do While Not objRS.EOF
For i = 0 to objRS.Fields.Count - 1
'Response.Write "ID " & objRS.Fields(i).Value
%>

<%
objCDO.Subject = "IT Help Desk #" & objRS.Fields(i).Value & ", " &
x_Recommendation_Type & ", " & x_System_Type strBody = strBody &
"Request ID: " & objRS.Fields(i).Value
%>

<%
Next
objRS.MoveNext
Loop

objRS.Close
set objRS = Nothing
objConn.Close
set objConn = Nothing
%>

Re: How to suppress "Either BOF or EOF is True" error

am 27.10.2005 20:48:39 von reb01501

Kermit Piper wrote:
> What I didn't explain earlier, is that below this code I have a CDONTS
> process which is dependent upon the recordset not failing:

Then either:

A) Put that process inside the if statement
B) Set a flag variable in your rs check:
dim bRsOK

bRsOK=false
if not objRS.EOF then
bRsOK = true
'do the other stuff with the recordset
end if
'later
if bRsOK then
'do your CDONTS stuff
end if

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.