Results 1 to 4 of 4

Thread: Deleting Records From a Table Using ADO &/or Query

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Posts
    70

    Cool

    Hi all,

    I have a table with 7 fields, 2 of which contain $ values. I want to delete all records, where both fields containing dollar values = $0.00. I am using ADO in VB6. Can anyone help me or supply me with some sample code that will do this?

    I thought it might invlove a query...
    Delete * from ... Where .... And .... =$0.00
    but am unsure how to do this.

    Cheers

  2. #2
    Junior Member
    Join Date
    Sep 2000
    Location
    Poland
    Posts
    26
    hi, use such sql statement:

    delete from TableName where 1stFieldName = 0 and 2ndFieldName=0

    Best wishes,
    Syl

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Posts
    70

    Unhappy

    I am trying to use the following code to delete records from a table using ADO.

    With DataEnvironment1
    Delete From .rscmdTemp WHERE .rscmdTemp!Sell = "0" AND .rscmdTemp!Breakeven = "0"
    End With

    I'm getting the error message, "Compile Error: Expected End of Statment"

    Can any body help?

  4. #4
    Junior Member
    Join Date
    Sep 2000
    Location
    Poland
    Posts
    26
    perhaps that can help, but it's necessary to have active connection set:

    Code:
    sub DeleteRecords
    dim rst as new adodb.recordset
    dim sSQL as string
    
       sSQL = "Delete From .rscmdTemp WHERE .rscmdTemp!Sell = 0  AND .rscmdTemp!Breakeven = 0"
       rst.Open sSQL, , , , adCmdText
    
    end sub

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