how do I check for existing records?

how do I check for existing records?

Post by Dalem1 » Sat, 23 Oct 1999 04:00:00



Hi,

I have several forms that use dbgrid to show a group of records.  If I use the
delete button to delete the last record in the group I get an error message
which states:

Run-time error '3021':  No current record

The code that I am using on the delete button is as follows:

    With Data1.Recordset
        .Delete
        .MoveNext
        If .EOF Then .MoveLast
    End With

Obviously it gets hung on the MoveLast ... but that seems necessary to me in
case a person deletes the last record in a group.

Thanks in advance for your help!

Dale

 
 
 

how do I check for existing records?

Post by ink » Sat, 23 Oct 1999 04:00:00


A recordset is empty if rs.EOF=TRUE and rs.BOF=TRUE. Check this first.

Regards
Kurt

Dalem111 schrieb in Nachricht

Quote:>Hi,

>I have several forms that use dbgrid to show a group of records.  If I use
the
>delete button to delete the last record in the group I get an error message
>which states:

>Run-time error '3021':  No current record

>The code that I am using on the delete button is as follows:

>    With Data1.Recordset
>        .Delete
>        .MoveNext
>        If .EOF Then .MoveLast
>    End With

>Obviously it gets hung on the MoveLast ... but that seems necessary to me
in
>case a person deletes the last record in a group.

>Thanks in advance for your help!

>Dale


 
 
 

how do I check for existing records?

Post by Peter Smit » Wed, 27 Oct 1999 04:00:00


I generally use the recordset.recordcount property also, you can't move the
last record if there isn't one


>Hi,

>I have several forms that use dbgrid to show a group of records.  If I use
the
>delete button to delete the last record in the group I get an error message
>which states:

>Run-time error '3021':  No current record

>The code that I am using on the delete button is as follows:

>    With Data1.Recordset
>        .Delete
>        .MoveNext
>        If .EOF Then .MoveLast
>    End With

>Obviously it gets hung on the MoveLast ... but that seems necessary to me
in
>case a person deletes the last record in a group.

>Thanks in advance for your help!

>Dale

 
 
 

1. how to check if record exists

Hello,

I am coding in VB 6.0 to access an SQL DB.  Right now writing a procedure to
handle adding records, and I want to check to see if the record exists
BEFORE adding it so I don't get an error.  Can someone tell me a way that I
can do so please?

Thank you,
D. Charles

2. SPs in SQL statements

3. DTS - Checking for existing record w/DTS

4. SQL 7.0 and cluster resource

5. check if a record exists

6. Informix DBA's and Developers needed around the US!

7. Check if record exist in database?

8. Restore

9. Check if Record exists - sproc

10. how to check if record exists

11. How to check if primary key constraint exist and drop it if it exist

12. Update existing record or insert new record.

13. Joining tables / using another record's value if record doesn't exist