access2007 error creating an adodb transaction -
11-22-2011
, 06:04 AM
I'm trying to create an ADODB transaction that
updates records, reads records, etc
tblQuoteDetail is a linked table to sql server 2005
this vba works fine
Dim cnn As ADODB.Connection
Dim rsQ As ADODB.Recordset
Dim strSql As String
Set cnn = CurrentProject.Connection
cnn.CursorLocation = adUseClient
cnn.CommandTimeout = 600
cnn.BeginTrans
strSql = "SELECT * FROM tblQuoteDetail where quoteId = 45934 and
suffix = 'A'"
Set rsQ = New ADODB.Recordset
rsQ.open strSql, cnn
this vba (with an extra UPDATE) fails at the "rsQ.open strSql, cnn"
line
Dim cnn As ADODB.Connection
Dim rsQ As ADODB.Recordset
Dim strSql As String
Set cnn = CurrentProject.Connection
cnn.CursorLocation = adUseClient
cnn.CommandTimeout = 600
cnn.BeginTrans
strSql = "UPDATE tblQuoteDetail" & _
" SET booked = false" & _
" WHERE quoteId = 45934" & _
" AND suffix = 'A'"
cnn.Execute strSql, , dbFailOnError
strSql = "SELECT * FROM tblQuoteDetail where quoteId = 45934 and
suffix = 'A'"
Set rsQ = New ADODB.Recordset
rsQ.open strSql, cnn
the error is
ODBC--call failed. ,Microsoft Office Access Database
Engine ,-2147467259
this is just a test to show the problem, the SELECT portion is
actually in a
common function, so I can't switch the order of the statements
I look at the sql server activity monitor and there are no locks
is there another way to use an ADODB connection to access a
sql server table without referencing a linked table ? |