Error 3021 EOF or BOF or deleted...Solving it in a stylish way

A

Atlas

Digging around I've read that the problem can arise on large recordsets at
server's cursorlocation.
Nevertheless even if treating a client cursor the problem still arised.

So I had to manually code a loop statement until the recordset's clone is
fully loaded....UGLY!

Any better hint???

Heres' the code

Dim rs As New ADODB.Recordset

rs.CursorLocation = adUseClient
rs.CursorType = adOpenStatic
Set rs = Me.RecordsetClone

Do While Me.Recordset.RecordCount <> rs.RecordCount
Loop

rs.Find "[ID Giornale] = " & globalIDgoto

'without the do loop statement, EOF is rised.....

If Not rs.EOF Then
Me.Bookmark = rs.Bookmark
End If
 
G

giorgio rancati

Hi Atlas,

I would do this
----
Dim Rs As New ADODB.Recordset
Set Rs = Me.Recordset.Clone

Do While Rs.State <> 1
Loop

Rs.Find "[ID Giornale] = " & globalIDgoto, 0, 1, 1

If Not Rs.EOF Then
Me.Bookmark = Rs.Bookmark
End If

Set Rs = Nothing
 
A

Atlas

giorgio rancati said:
Hi Atlas,

I would do this
----
Dim Rs As New ADODB.Recordset
Set Rs = Me.Recordset.Clone

Do While Rs.State <> 1
Loop

Rs.Find "[ID Giornale] = " & globalIDgoto, 0, 1, 1

If Not Rs.EOF Then
Me.Bookmark = Rs.Bookmark
End If

Set Rs = Nothing

Ciao Giorgio,
thanks for answering.... can you explain this beheaviour ?
 
G

giorgio rancati

Atlas said:
Ciao Giorgio,
thanks for answering.... can you explain this beheaviour ?

Hi Atlas,

When a form is opened the server starts transmitting it the data. In this
first operation the Recordset.State is set to 9 ( 8 + 1 look at
ObjectStateEnum). When the form receives all data the Recordset.State is set
to 1.
The statement
----
Do While Rs.State <> 1
Loop
----
it monitors that all data arrived.

I hope I have explained :)

Ciao
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Run-time error 3021 6

Top