PDA

Click to See Complete Forum and Search --> : ADO - rs.Close or set rs=nothing


kovan
Aug 23rd, 2000, 09:36 AM
ADO - rs.Close or set rs=nothing

which one is better?

if i set RS = Nothing do i have to
put
Set RS = New ADODB.Recordset
before i can use this record again?

thanks

Stevie
Aug 23rd, 2000, 09:42 AM
I always use both when closing ...


rs.Close
set rs = Nothing


I also always "set rs = new adodb.recordset" when re-using a recordset.

Ianpbaker
Aug 23rd, 2000, 09:43 AM
Hi again kovan

Yes if you set it to nothing you have to re-set it.

if you need to use the recordset again, use rs.close and when you come to terminate your app, then set it to nothing

Ian

Gary.Lowe
Aug 23rd, 2000, 09:51 AM
Kovan

i found this useful to close recordsets without erros



If Not rstTemp Is Nothing Then
rstTemp.Close
Set rstTemp = Nothing
End If



I f I have any recordsets in a project I just create a function with the above for each recordset, database, workspace, then I know every thing has been closed properly.