
ClientBatch with Update method, error 40041
Can someone explain why I get error:
40041 Object Collection: Couldn't find item indicated by text.
when the UPDATE statement is executed. The information is placed in the
rdoErrors collection.
The update works, but I would like to better understand what is going on.
Sub main
Dim cn As New rdoConnection
Dim rs As rdoResultset
Dim col As rdoColumn
Dim re As rdoError
' configure the connection
With cn
.CursorDriver = rdUseClientBatch
.Connect = "DRIVER={SQL Server};SERVER=DFWCSCQ1;database=quotes"
.EstablishConnection rdDriverNoPrompt, True
' clear messages
rdoEngine.rdoErrors.Clear
End With
Set rs = cn.OpenResultset("exec QuoteHeaderByQuoteNo 10179",
rdOpenDynamic, rdConcurBatch)
' identify source of fields
For Each col In rs.rdoColumns
col.SourceTable = "Quotes.dbo.QuoteHeaders"
col.SourceColumn = col.Name
Next
' identify the key column
rs.rdoColumns("QuoteNo").KeyColumn = True
If Not (rs Is Nothing) Then
rs.Edit
rs.rdoColumns("VersionNo") = 99
rs.Update ' error is generated here
rs.BatchUpdate
rs.Close
End If
cn.Close
end sub
Thanks,
Harold