Hi all,

I wrote the following code and want to delete the filtered records from the disconnectd recordset. But when "rstb.Delete adAffectGroup" is executed, error occured saying ---> operation is not allowed in this context. What have i done wrong? Could any one please hep me? Thanks!

Dim rsta As ADODB.Recordset

Set rsta = New ADODB.Recordset

Dim rstb As ADODB.Recordset
With rsta
.ActiveConnection = "dsn=Test1"
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockBatchOptimistic
.Open "select * from test1"
Set .ActiveConnection = Nothing
End With

Set rstb = rsta.Clone()

rstb.Filter = "name <> 'z'"

rstb.Delete adAffectGroup