Results 1 to 6 of 6

Thread: Specific Delete with recordsets

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    96
    Hi,

    I'm using ADODB.recordset and I want to delete specific records from my recordset.

    I know how to do this in SQL but I'm unsure of how to do it with recordsets.

    Can anyone help?

    H.
    Just trying to muddle through...

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    96
    Does anyone have any ideas on how to do this?

    I want to be able to delete all records where the name = "example" from a recordset.

    H.
    Just trying to muddle through...

  3. #3
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Halifax,UK
    Posts
    274
    You can open a recordset with an SQL DELETE function as the record source or- On your recordset use the filter property to just select the ones you want to delete and delete them all-
    recordset.Filter = "Field = 'example'"

    remember to turn the filter off afterwards to return to the ful recordset-

    recordset.filter=""


    Regards

    Chris


    VB6 VS2005

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    96

    Talking

    Thank You!

    H.
    Just trying to muddle through...

  5. #5
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Halifax,UK
    Posts
    274
    Sorry my last reply was misleading.
    the first option should have said execute the SQL on the connection- e.g

    sqlString = "DELETE * FROM table WHERE [field] = 'example';"

    database.Connection1.Execute sqlString
    VB6 VS2005

  6. #6
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Smile

    To do this with recordset, i think you need to locate the record location first by the FindFirst method then follow by the delete method in you recordset object.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width