I have a very simple problem which I have spent 2 days googling for an answer, to no help.
I an receiving a wrong value back for recordsaffected from a batabase connection execute ...
it seems that once the lngRecsAff is set, it stays the same value regardless of success or fail from each successive execution.
(I am of course expecting a 0 in no record was created and a 1 if it was)
Dim cn As ADODB.Connection
Dim strSQL As String
Dim lngRecsAff As Long
Set cn = New ADODB.Connection
"Provider = sqloledb;" & _
"Data Source=WSP0470.datasource.com;" & _
"Initial Catalog=QTS;" & _
"User ID=user;" & _
For i = 2 To lastrow
strSQL = "INSERT INTO .."
cn.Execute strSQL, lngRecsAff, adExecuteNoRecords
If lngRecsAff = 0 Then 'there was a problem and no record was added
qtyRowsFailed = qtyRowsFailed + 1
Else 'all cool
qtyRowsAddedToDatabase = qtyRowsAddedToDatabase + lngRecsAff
even if I were to set lngRecsAff = 5, it just stays that value though the entire loop ..?