F
fbonnard
Hi everybody
İ need to do several queries. But i don't know how to proceed wit
one recordset.
So i trıed to close and open a new one. (in the if statemen
loop)
Unfortunately this trick desn't work. Does somebody has a clue abou
that ?
Here is a part of my code
Set rs = New ADODB.Recordset
For i = 1 To 200
myAcc = Sheets("0904").Cells(i, 1).Value
mySql1 = "SELECT account from balance where (account='" & myAcc & "')"
mySql3 = "INSERT into balance (account,04 january) VALUES ('" & myAcc
"', 200)"
mySql4 = "UPDATE balance SET [04 january] = '500' WHERE account = '"
myAcc & "'"
rs.Open mySql1, cn, adOpenStatic
Range("A" & i).Value = rs.RecordCount
Range("B" & i).CopyFromRecordset rs
rs.Close
If (Range("B" & i).Value > 0) Then
rs.Open mySql4, cn, adOpenStatic
rs.Close
Else
rs.NextRecordset mySql3, cn, adOpenStatic
rs.Close
End If
Next i
:eek
İ need to do several queries. But i don't know how to proceed wit
one recordset.
So i trıed to close and open a new one. (in the if statemen
loop)
Unfortunately this trick desn't work. Does somebody has a clue abou
that ?
Here is a part of my code
Set rs = New ADODB.Recordset
For i = 1 To 200
myAcc = Sheets("0904").Cells(i, 1).Value
mySql1 = "SELECT account from balance where (account='" & myAcc & "')"
mySql3 = "INSERT into balance (account,04 january) VALUES ('" & myAcc
"', 200)"
mySql4 = "UPDATE balance SET [04 january] = '500' WHERE account = '"
myAcc & "'"
rs.Open mySql1, cn, adOpenStatic
Range("A" & i).Value = rs.RecordCount
Range("B" & i).CopyFromRecordset rs
rs.Close
If (Range("B" & i).Value > 0) Then
rs.Open mySql4, cn, adOpenStatic
rs.Close
Else
rs.NextRecordset mySql3, cn, adOpenStatic
rs.Close
End If
Next i
:eek