ACC2000: Access Hangs When Mixing DDL and ADO Transaction MethodsID: Q202396
|
When you mix ActiveX Data Objects (ADO) transaction methods with Microsoft Jet 4.0 Data Definition Language (DDL) transaction statements, Microsoft Access and/or the Visual Basic Editor may stop responding (hang).
To avoid this problem, do not mix ADO transaction methods with Jet DDL transaction statements. They should all be one or the other. For an example, see the "Steps to Reproduce Behavior" section later in this article.
If Access and/or the Visual Basic Editor stops responding, follow these steps:
Microsoft ADO Ext. 2.1 for DDL and Security
Sub JET40Transaction()
Dim conn As New ADODB.Connection
Dim SQL As String
Dim ADOXCat As New ADOX.Catalog
On Error GoTo ErrorHandler
Kill "c:\Test1.mdb"
ADOXCat.Create "Provider=Microsoft.Jet.OLEDB.4.0; _
Data Source=c:\Test1.mdb"
With conn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open "Data Source=c:\Test1.mdb"
.Execute "CREATE TABLE TASKS ([Emp ID] Char(5), EmpName char(20));"
.Execute "INSERT INTO TASKS ([Emp ID],EmpName) VALUES ('1','Bob');"
.Execute "INSERT INTO TASKS ([Emp ID],EmpName) VALUES ('5','Joe');" End With
conn.Execute "BEGIN TRANSACTION"
conn.Execute "DELETE Tasks.[Emp ID], Tasks.*" & _
"From Tasks" & " WHERE (((Tasks.[Emp ID])='5'));"
conn.CommitTrans
Exit Sub
ErrorHandler:
If Err = 53 Then
Resume Next
End If
MsgBox Error & " error # " & Err
End Sub
Jet40Transaction
Note that Access and the Visual Basic Editor stop responding.
conn.Execute "COMMIT TRANSACTION"
which replaces:
conn.CommitTrans
For more information about using ADO transaction methods, in the Visual Basic Editor, click
Microsoft Visual Basic Help on the Help menu, type "Connection property" in
the Office Assistant or the Answer Wizard, and then click Search to
view the topic.
For more information about using Jet 4.0 DDL transaction statements, in the Visual Basic Editor, click
Microsoft Visual Basic Help on the Help menu, type "Data Definition Language" in
the Office Assistant or the Answer Wizard, and then click Search to
view the topic.
Additional query words: pra BeginTrans RollbackTrans Rollback
Keywords : kbdta
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: May 13, 1999