is Nothing vs = Empty



I want to put code in my routines to be sure that a recordset is never left
unclosed, to prevent memory leaks, as I've been advised. The following
script was suggested, and it seems to work fine. Sometime the recordset
shows a value of "Nothing" when I hover over it in the debugger, and the
code is not executed. Sometimes it is populated, and the code is executed.
Great. But sometimes the recordset shows a value of "Empty" when I hover
over it in the debugger, and in those cases the code is executed and I get
an error: "Object Required" I haven't been able to figure out what causes a
recordset to = "Empty" in some situations and "Nothing" in others. Can
someone suggest code that will work in all situations? I don't know how to
test for "Empty."

If Not (irst_ClassPeriods Is Nothing) Then
irst_ClassPeriods.Close
Set irst_ClassPeriods = Nothing
End If


.



Relevant Pages

  • Re: type mismatch
    ... Did you try specifying either ByVal or ByRef and seeing if it made a ... Did you run the code in the debugger and see if you are getting ... the recordset? ...
    (microsoft.public.office.developer.outlook.forms)
  • Re: visualizing recordsets while debugging
    ... > single recordset. ... After executing the join (while the debugger is ... You could set up a watch for each column or you could watch the entire ...
    (microsoft.public.vb.general.discussion)
  • Re: close recordset before nothing
    ... If you do not do this, then you might experience a memory leaks. ... there is no garbage collector as in .NET, so most likely recordset resources ...
    (microsoft.public.data.ado)
  • Re: close recordset before nothing
    ... If you do not do this, then you might experience a memory leaks. ... there is no garbage collector as in .NET, so most likely recordset resources ...
    (microsoft.public.vb.database.ado)
  • Re: OLE error 80040200 when assigning events of a TCustomADODatasetpointingto a multi-select stored
    ... all properties should be set on initial recordset before Open. ... recordsets will inherit properties. ... There should be no memory leaks because TADODataSet is not reference ...
    (borland.public.delphi.database.ado)

Quantcast