How do I fix this error message ADODB.Field error '800a0bcd' Either BOF or EOF is True

ADODB.Field error '800a0bcd'

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

/www/downloads/ftn/trainingschedule/trainemail.asp, line 75

here is the code for the page line 75 has this tag --ERROR--

<% 'option explicit %>
Response.CacheControl = "no-cache"

<!--#include virtual = "/www/downloads/jjd/Utils/File_IO.asp"-->
<!--#INCLUDE virtual = "/www/downloads/jjd/Utils/adovbs.asp"-->
<!--#Include virtual = "/www/downloads/jjd/secure/DataInfo.asp" -->
<!--#Include virtual = "/www/Include/UsgInclude.asp" -->
<!--#Include virtual = "/www/downloads/jjd/Utils/SendEmail.asp" -->

  'Declare local variables that will be used on this screen
  DIM rc, strquery
  DIM rsMain, strMark
  DIM stremployeename, strCoursename
  DIM strstartdate, strstarttime, strcoursedescription
  DIM szLogMsg, szLogMsgEnd
  DIM mail, strEmailMsg

  ' Create and Open a recordset to the SQL database tables  

Set rsMain = Server.CreateObject("ADODB.Recordset")
strquery = "SELECT *  FROM vw_training_leader_email_data (nolock) WHERE EEID = '" &  strEEID  & "' and classID = '" & strclassId & "' ; "
rsMain.Open strQuery,strConnectFtnWeb,adOpenKeyset,adLockReadOnly,adCmdText

'stremployeename = rsMain("EmployeeName")
'strCoursename = rsMain("CourseName")
'strstartdate = rsMain("StartDate")
'strstarttime = rsMain("StartTime")
'strcoursedescription = rsMain("CourseDescription")

' Prepare Manager Email Message
szLogMsg = ""

szLogMsg = szLogMsg & "<HTML>"
szLogMsg = szLogMsg & "<HEAD></HEAD>"
szLogMsg = szLogMsg & "<BODY><DIV><FONT size=3>"
--ERROR HERE -- szLogMsg = szLogMsg & "<FONT face=Arial><u> " & rsMain("employeeName").Value & "</U></FONT>"
szLogMsg = szLogMsg & "has enrolled in the <U>"  
szLogMsg = szLogMsg & "rsMain('CourseName') &" 
szLogMsg = szLogMsg & "</U> class that will be held on &nbsp;<EM><u>"
szLogMsg = szLogMsg & "rsMain('StartDate') &" 
szLogMsg = szLogMsg & "</U></EM> at <U>"
szLogMsg = szLogMsg & "rsMain('StartTime') &"
szLogMsg = szLogMsg & "</U>.&nbsp; <o:p></o:p></FONT>"
szLogMsg = szLogMsg & "<P><FONT size=3><U>"
szLogMsg = szLogMsg & "rsMain('Coursename') &" 
szLogMsg = szLogMsg & "</U>is:</FONT></P><P><FONT size=3>"
szLogMsg = szLogMsg & "rsMain('CourseDescription') &"
szLogMsg = szLogMsg & "</FONT></P>"
szLogMsg = szLogMsg & "<FONT size=3>You do not need to take any further action, if this meets your approval.</FONT>"
szLogMsg = szLogMsg & "<FONT size=3>&nbsp;</FONT>"
szLogMsg = szLogMsg & "<FONT size=3>However, if you would like this enrollment canceled or another date/time chosen, please click here to view the Frequently Asked Questions on the Training Web site. </FONT>"
szLogMsg = szLogMsg & "<FONT size=3> <br><br>Thanks, </FONT>"
szLogMsg = szLogMsg & "<FONT size=3>Total Comp</FONT></P></FONT></DIV><br>"
szLogMsg = szLogMsg & "</BODY></HTML>"

szLogMsgEnd = ""

' Append Feedback info to the ManagerEmail Log file

DIM szFile
szFile = "ManagerEmail_" & Year(Date) & "-" & Month(Date) & ".log"
rc = AppendToFile (szFile, szLogMsg & szLogMsgEnd)

'If error, set up error message information to pass to the error webpage
if (rc <> 0) then

      Session("ErrorOnFormName")      = "My Stuff - Employee Training Signup"
      Session("ErrorNumber")            = rc
      Session("ErrorDescription")      = ""
      Session("ErrorSource")            = "Error on AppendToFile"

      Response.Redirect ("emailerror.asp")

end if

' Email Manager

szMark = "  |  "

dim strTo, strCc, strBcc, strFrom, strSubject, strMessage, strAttachment, strResults

  strTo         = ""
  strCc         = ""
  strBcc        = ""
  strFrom       = "TotalComp@jjd
  strSubject    = "My"
  strMessage    = szLogMsg
  strAttachment = "" 

  strResults    = SendEmailMsg(strTo, strCC, strBcc, strFrom, strSubject, strMessage, fSendMsgAsHTML, strAttachment)

  If strResults(0) <> 0 Then

      szErrorMsg = Date & szMark & Time & szMark & strResults(0) & szMark & " Email Not Sent to " & strTo & szMark & strResults(1)
      AppendToFile "ManagerEmail.log", szErrorMsg

      Session("ErrorOnFormName")      = "My"
      Session("ErrorNumber")            = strResults(0)
      Session("ErrorDescription")      = ""
      Session("ErrorSource")            = szErrorMsg

End If

set rsmain = nothing

Who is Participating?
kiddangerConnect With a Mentor Commented:
I'll just comment on all I see at a quick glance.  Hope you find it helpful...

If you're going to use recordset looping, which I try to discourage, then you should test first and also move to the first record.


If Not rsMain.BOF and Not rsMain.EOF Then
end if

String concatenation is processor intensive and slow.
Open connections late and close early.  Recordset looping doesn't do that. getRows is a better alternative.
Buffering your page will give you better performance.
Use Response.Buffer right after Option Explicit - Not sure why you have it commented out.  It helps during debugging.
CSS is better than deprecated HTML markup.
It is better to DIM multiple variables on one line than single ones per line.
Dim var1, var2, var3
Dim var1
Dim var2
Dim var3
Organize your code and dim all public variables in one area and all private variables in one area.
Dim pubVar1, pubVar2, pubVar3
' code follows

instead of

Dim pubVar1

' code follows

Dim pubVar2

' more code follows

Use subs/functions when possible as well as private variables over public, when possible.
Always clear object variables.  I never saw this closed: strConnectFtnWeb
seems like your recordset is not returning any records. check the query in the backend.

put conditions like rsMain.EOF=False and then do the concatinations.

Try it.!

when you do a select query, you should to check for the condition whether your query returns any record first:

rsMain.Open strQuery,strConnectFtnWeb,adOpenKeyset,adLockReadOnly,adCmdText

if not rsMain.EOF then

  stremployeename = rsMain("EmployeeName")
  strCoursename = rsMain("CourseName")
  strstartdate = rsMain("StartDate")
  strstarttime = rsMain("StartTime")
  strcoursedescription = rsMain("CourseDescription")
else   'eof (no record)
   response.write("<p>No Record returned</p>")
end if
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

MrJarvis2004Author Commented:
My results is saying no records found but the query works in the backend.
You can also put an on error resume next. This will allow you to jump over little errors like this. However you then have to put in some error checking in places that may require authentication.
you must use rsMain.MoveNext() whenever you're trying to pull a row/record from the recordset, that's why you're getting this error

Do Until rsMain.EOF
what are you trying to do..? how do you want results to be displayed..?
Thank you Mr. Jarvis.  (O:=
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.