View Single Post
  #5  
Old August 18th, 2004, 04:23 PM
Boris
external usenet poster
 
Posts: n/a
Default

Dan Artuso wrote:
Hi,
Is Nothing is used to see if an Object variable is 'Set' or not.
It's not used to see if a recordset is empty or not.
I usually use it like this:

ExitHe
If Not rs Is Nothing Then
Set rs = Nothing
End If

To see if your recordset is empty, get the record count if possible,
or check the EOF and BOF properties.


Thanks for your answer. However that's not the problem. The production
database uses code likes this:

If Not Me.Recordset Is Nothing Then
If Not (Me.Recordset.BOF Or Me.Recordset.EOF) Then
...
End If
End If

Checking for empty recordsets works without any problems. The problem is
that it causes a runtime error 3021 when you close the main form. I stripped
the code as much as possible for my test database to track the bug. For
runtime error 3021 it just matters that you test "Me.RecordSet Is Nothing".
I don't do anything else in Form_Current() in my test database but still get
runtime error 3021. If I comment the if-then-clause the runtime error
strangely disappears?

Boris

[...]