lol. trying to answer a few questions now to make it worth while. I'm soooo broke. lol.
On topic: I can't open the recordset to check if there are any because it dies if there are none!
Main Topics
Browse All Topics strQuery = "Select * From Details Where UserID='" & strUserID &"'"
Set conn = Server.CreateObject("ADODB
conn.Open strConnect
rs.Open strQuery, conn, adOpenForwardOnly, adLockOptimistic, adCmdText
If strUserID exists then the open operation works fine and I can get the details and paint the screen. But if strUserID does NOT exist, I get:
Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/User/staff.asp, line 101
Any idea what I'm doing wrong?
sorry. only have 30 pts:(
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Of course it's there.
If I do: (where 4 IS in the database)
strQuery = "Select * From Details Where UserID="4"
Set conn = Server.CreateObject("ADODB
conn.Open strConnect
rs.Open strQuery, conn, adOpenForwardOnly, adLockOptimistic, adCmdText
I can can get the details with rs("details")
If I do: (where 2 IS NOT in the database)
strQuery = "Select * From Details Where UserID='" & strUserID &"2"
Set conn = Server.CreateObject("ADODB
conn.Open strConnect
rs.Open strQuery, conn, adOpenForwardOnly, adLockOptimistic, adCmdText
The rs.open dies with the error.
If I request where UserID is 4 (or any other that IS IN the database) I can paint the details to to screen. BUT if UserID is 2 (is NOT in the table) I get an error trying to open the table/recordset.
strQuery = "Select * From Details Where UserID="2"
rs.Open strQuery, conn, adOpenForwardOnly, adLockOptimistic, adCmdText
produces this error:
<b>
Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/User/staff.asp, line 101
</b>
After spending all night trying to figure this out, I uninstalled/reinstalled visual studio this morning. Seems like some components were messed up (ADODB?) because reinstalling seems to have fixed it.
I wasn't trying to look at a record that didn't exist. I couldn't open an EMPTY recordset. Checking for bof or eof wasn't possible because it would error out in the attempt to simply open an empty recordset.
This is an intuitive shot in the dark at the cause: I suspect this may be an obscure bug in the adOpenForwardOnly parameter because in some cases, you can get a recordcount without a movelast in Access Basic, that means it may be looking ahead when the recordset opens. Since I have both Office 2007 and Access 2003 loaded, maybe it created an issue. But for all I know... it could be something as simple as the alignment of the moon and mars with pluto.
Steven.
I created a Database. And then added in some entries. TO TEST
What I provided here BEFORE I provided it here.
I got the same exact error as you got, on the same blasted line.
And then I added in the code that I provided above, and it fixed the issue.
When you get the EOF BOF errors
You first and foremost want to look at if the record exist.
And if it does-not, then do something about it. You want to stop it from processing.
And in this case, I stopped it by using the
If not rs.EOF then
This fixed the issue in my demo, it would fix yours as well.
If you do not want to learn how to trouble shot your code then you need to find another way to do your coding.
Carrzkiss
carrzkiss,
I've been doing this since 1992, so I know how to open a recordset. lol.
Of course you have to check to see if there are any records in the recordset (if rs.bof or rs.eof is true then it's empty) before you look at it via an assignment statement like strVar=rs("field")
HOWEVER,
To look at EOF and BOF you must OPEN the recordset with
rs.Open strQuery ... (ok so far)If the record in the WHERE clause exists then I can check EOF and BOF. No problem
BUT.... and here's the really important part!!!!!
If the record is not found (doesn't exist) in the table, as in my example above, then I was getting the error AS the recordset was open.
Right at the rs.Open strQuery ... line.
So checking BOF or EOF is impossible at this point. You actually have to get to the If rs.BOF or rs.EOF BREAKPOINT to check if records exist.
...BTW, I use visual studio and attach the process to debug so I don't have to use response.write for too much.
Hope that clears it up.
Thanks.
Business Accounts
Answer for Membership
by: chilternPCPosted on 2009-07-05 at 16:02:50ID: 24781625
30 points?
the error message is correct - you must design the test to catch that reposnce