Deleting a record in a ADO recordset 
Author Message
 Deleting a record in a ADO recordset

When I want to delete a record in a ADO recordset, I use the following code:

rs.Delete
rs.MovePrevious
If rs.BOF Then
    rs.MoveFirst
Endif

Quite simple, I thought.
When I am deleting the first and the second record, everything goes as
planned.
When I am deleting another record in the set, the pointer doesn't move to
the
previous record as it should do, but to the record previous to the previous
record (so it goes back two rexords).
Anyone has any idea why that is and how it can be set straight?

Many thanks and greetings from Brugge (Bruges - Belgium),

Michel



Fri, 05 Jul 2002 03:00:00 GMT  
 Deleting a record in a ADO recordset
hoi Michel,

i think the way you use your code is not correct. I am asking myself the
question whether you want to pick a certain record in your table and delete
it?
If that is so, let me know, because you have to use a query to accomplish
that.

groetjes,
Niels.



Quote:
> When I want to delete a record in a ADO recordset, I use the following
code:

> rs.Delete
> rs.MovePrevious
> If rs.BOF Then
>     rs.MoveFirst
> Endif

> Quite simple, I thought.
> When I am deleting the first and the second record, everything goes as
> planned.
> When I am deleting another record in the set, the pointer doesn't move to
> the
> previous record as it should do, but to the record previous to the
previous
> record (so it goes back two rexords).
> Anyone has any idea why that is and how it can be set straight?

> Many thanks and greetings from Brugge (Bruges - Belgium),

> Michel



Sat, 06 Jul 2002 03:00:00 GMT  
 Deleting a record in a ADO recordset
Hoi all,

Did u open the record set with the CursorType set as adOpenKeySet or
adOpenDynamic.
If not the recordset is opend adOpenForwardOnly and it does what the
names says,
you can only move forward in the recordset.

Doei Diego

Quote:

> When I want to delete a record in a ADO recordset, I use the following code:

> rs.Delete
> rs.MovePrevious
> If rs.BOF Then
>     rs.MoveFirst
> Endif

> Quite simple, I thought.
> When I am deleting the first and the second record, everything goes as
> planned.
> When I am deleting another record in the set, the pointer doesn't move to
> the
> previous record as it should do, but to the record previous to the previous
> record (so it goes back two rexords).
> Anyone has any idea why that is and how it can be set straight?

> Many thanks and greetings from Brugge (Bruges - Belgium),

> Michel



Sat, 06 Jul 2002 03:00:00 GMT  
 Deleting a record in a ADO recordset
When you delete a record from the recordset, the cursor has to move to point to
some record, doesn't it?  My guess is that when you delete record 100 the
cursor automatically points to 99 since 100 is no longer there.  Then your code
tells it to move back one more (moveprevious), hence you're now looking at 98.


Quote:

>When I want to delete a record in a ADO recordset, I use the following code:

>rs.Delete
>rs.MovePrevious
>If rs.BOF Then
>    rs.MoveFirst
>Endif

>Quite simple, I thought.
>When I am deleting the first and the second record, everything goes as
>planned.
>When I am deleting another record in the set, the pointer doesn't move to
>the
>previous record as it should do, but to the record previous to the previous
>record (so it goes back two rexords).
>Anyone has any idea why that is and how it can be set straight?

>Many thanks and greetings from Brugge (Bruges - Belgium),

>Michel



Sat, 06 Jul 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Deleting a record in a ADO recordset

2. Q ADO-Recordset:how to find deleted records

3. datagrid 6.0 with ado recordset and deleting records

4. Deleting all Records in ADO Recordset

5. Delete all records in ADO Access database recordset

6. Method of delete all records in ADO Recordset.

7. ADO Recordset - delete last record then ????

8. ADO deleted record still in new recordset

9. Deleting ADO Recordset Records

10. Deleting all records from ADO recordset

11. MOVELAST Fail after deleting the last record in a ADO recordset

12. Deleting records from a recordset without deleting from the database

 

 
Powered by phpBB® Forum Software