Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQLServer7

Status
Not open for further replies.

bluenoser337

Programmer
Jan 31, 2002
343
CA
Trying to re-create an application in XP Pro that was originally created for Windows 2000 using VB6 and SQLServer7.

Everything seemed to install fine, and my server is running. When the VB (not VBA) application tries to add records...I get this...

"RUN-TIME ERROR 3021 - EIther BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record."

I was thinking there may be a Windows XP incompatibility, but I have seen this before in the original application (but can't remember how I fixed it)....so, not sure.

Any suggestions greatly appreciated!!
 
If I had to guess, I would suggest that your VB6 application expects there to be data in a particular table, but there isn't any.

I believe that error message is actually coming from ADO, the underlying technology that you are probably using to connect to the database.

I suggest that you first check for tables without any rows. If this doesn't help, then compare the computers to make sure they are using the same version of ADO.




-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
bluenoser337 said:
but I have seen this before in the original application
And that means the problem is a bug in the code, and it's always been there.

And the bug is.......

.......that it is trying to do some operation with the recordset that requires it to be positioned on a valid record.

So the question is, why is it not an a valid record? Most likely reason is that whatever SQL statement used to open the recordset has returned no records.

How to avoid the error? Do this:
Code:
If Not (rs.BOF OR rs.EOF) Then
  'Put your original code that causes the error here
Else
  'Do whatever is appropriate when this logic error
  'occurs (apparently the original programmer thought this
  'should never happen - or was just sloppy) - this might
  'be an error message displayed to the user, for example.
End If

If this doesn't work, next post show your actual code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top