dbTalk Databases Forums  

access2007 error creating an adodb transaction

comp.databases.ms-access comp.databases.ms-access


Discuss access2007 error creating an adodb transaction in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Roger
 
Posts: n/a

Default 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 ?

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.