PDA

Click to See Complete Forum and Search --> : Deleting Records From a Table Using ADO &/or Query


JonnyCab
Sep 26th, 2000, 01:52 AM
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

Syl
Sep 26th, 2000, 01:55 AM
hi, use such sql statement:

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

Best wishes,
Syl

JonnyCab
Sep 26th, 2000, 07:10 AM
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?

Syl
Sep 26th, 2000, 07:18 AM
perhaps that can help, but it's necessary to have active connection set:


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