B
blgilbert
Hi,
I'm running an Access 2000 mdb connected to SQL 2000 with ODBC.I have a
transaction that looks something like this:
Public Sub DoSomething()
Dim rstThis as DAO.Recordset
Dim qdfThis As DAO.QueryDef
Set qdfThis = CurrentDb().QueryDefs("qryMyQueryName")
qdfThis.Execute dbFailOnError + dbSeeChanges
If qfdThis.RecordsAffected>0 Then
Set qfdThis=CyrrentDb().QueryDefs("qryMySecondQueryName") '
querydef inserts into 'tbl1'
qfdThis.Execute dbFailOnError + dbSeeChanges
Endif
DoSomethingElse
CommitTrans
End Sub
' The following is contained in a class module
Public Sub DoSomethingElse()
Dim rst As DAO.Recordset
Dim strSQL as String
strSQL = "Select * From tbl1 Where blah-de-blah"
Set rst = CurrentDb().OpenRecordset(strSQL, dbOpenSnapshot)
Do Until rst.EOF
' do stuff here
Loop
End Sub
The table being read in DoSomethingElse is the same table being
inserted into in the 2nd execute statement in the main sub. When It
reaches the OpenRecordset command in DoSomethingElse, it hangs and
eventually returns DAO error 3146, ODBC call-failed.
This works fine when I'm connecting to a Jet back-end. It works fine
when I comment out the transaction statements. I've also tried using
Workspaces(0).BeginTrans, but it didn't help.
Any ideas or thoughts?
Thanks in advance,
Barry Gilbert
I'm running an Access 2000 mdb connected to SQL 2000 with ODBC.I have a
transaction that looks something like this:
Public Sub DoSomething()
Dim rstThis as DAO.Recordset
Dim qdfThis As DAO.QueryDef
Set qdfThis = CurrentDb().QueryDefs("qryMyQueryName")
qdfThis.Execute dbFailOnError + dbSeeChanges
If qfdThis.RecordsAffected>0 Then
Set qfdThis=CyrrentDb().QueryDefs("qryMySecondQueryName") '
querydef inserts into 'tbl1'
qfdThis.Execute dbFailOnError + dbSeeChanges
Endif
DoSomethingElse
CommitTrans
End Sub
' The following is contained in a class module
Public Sub DoSomethingElse()
Dim rst As DAO.Recordset
Dim strSQL as String
strSQL = "Select * From tbl1 Where blah-de-blah"
Set rst = CurrentDb().OpenRecordset(strSQL, dbOpenSnapshot)
Do Until rst.EOF
' do stuff here
Loop
End Sub
The table being read in DoSomethingElse is the same table being
inserted into in the 2nd execute statement in the main sub. When It
reaches the OpenRecordset command in DoSomethingElse, it hangs and
eventually returns DAO error 3146, ODBC call-failed.
This works fine when I'm connecting to a Jet back-end. It works fine
when I comment out the transaction statements. I've also tried using
Workspaces(0).BeginTrans, but it didn't help.
Any ideas or thoughts?
Thanks in advance,
Barry Gilbert