Hey all,
I am testing a http link search robot I created. I am getting a Runtime Error 3021 which I don't know a lot about. I was hoping some of you could help.
The message I get is:
Run-time error '3021':
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
When I click on the Debug button, it gives me the following statement to fix:
VB Code:
buf = rsURL!URL & " (" & rsURL!relevance & ")"
Thank you for your help in advance.
Khanjan
Hey... If you found this post helpful please rate it.
Well, there is nothing wrong with that line of code by itself. However if you want to get the value of a recordset field it must contain something. According to the error message the recordset is either empty or not currently pointing to any record. Normally before you read from a recordset you would first check that the EOF (End Of File) property isn't true. Can you show a little bit more of your code?
Post it as a .zip file. Many people have no way of opening a .rar file. It would also help you to get an answer if you indicated which form the error occurred in (and which sub or function).
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana
Your loop keeps going until you reach the end of the recordset (after all the records).. but it seems that you are already at the end of the recordset before the loop starts - which is why there is no data to be retrieved by that line (and hence the error).
You need to basically not let the loop run if there is no data, which can be done by:
a) Putting an IF block around the loop. eg:
VB Code:
If Not rsURL.EOF Then
Do
...
Loop While Not rsURL.EOF
End If
or b) Changing the structure of the loop slightly (so it is never entered if there is no data - but still exits at the end of the data), eg: