Hiya,
I'm trying to loop through every row in a recordset and if the field rectype = 2 then execute some SQL on another SEPERATE ADO connection that deletes all rows from a table.
For the row in the recordset that has the rectype of 2, I want to get the value of field "DistID" and use that in the WHERE clause of the SQL Delete.
If recordset row(number) field("rectype") = 2 then
string variable DistID =
recordset row(number) field("DistID").value
End If
Can someone please help as I can't get it work. I'm very new to ADO stuff. Here's where I am at the moment:
Can anyone help me out here?
I'm trying to loop through every row in a recordset and if the field rectype = 2 then execute some SQL on another SEPERATE ADO connection that deletes all rows from a table.
For the row in the recordset that has the rectype of 2, I want to get the value of field "DistID" and use that in the WHERE clause of the SQL Delete.
If recordset row(number) field("rectype") = 2 then
string variable DistID =
recordset row(number) field("DistID").value
End If
Can someone please help as I can't get it work. I'm very new to ADO stuff. Here's where I am at the moment:
Code:
Do While Not rsUpdate.EOF
For i = 0 To rsUpdate.Fields.Count - 1
If rsUpdate.Fields("RecType").Value = 2 Then
DistID = rsUpdate.GetRows(rsUpdate("DistID")(i)).Value
con2.Execute ("DELETE * FROM Mainframe " _
& "WHERE DistID = " & DistID)
End If
Next i
Loop
Can anyone help me out here?