Delete Recordset

G

Greg Franke

Is there a way to delete an ADO recordset once it has been created?

Thanks,
Greg
 
C

Chris Nebinger

What do you mean by delete? Delete all the records in the
recordset from the original table? If so, then the answer
is it depends on the method used to open it. Snapshots,
Forward-only, and read only's the answer would be no. For
Keysets:

rst.movefirst
do until rst.eof
rst.delete
rst.movenext
loop


If you just want to destroy the variable:

Set rst = nothing

That clears out the recordset from memory, but the
underlying records are intact.


Chris Nebinger
 
G

Greg Franke

Thanks man, your advice worked!

I wanted to destroy the recordset and recreate it.

Thanks again!
Greg
 
C

Chris Nebinger

You could just reset the variable:

ADO:

Set rst = New ADODB.Recordset

DAO:

Set rst = dbs.OpenRecordset("SQL HERE")

Chris Nebinger
 
Top