This article was previously published under Q202396
Advanced: Requires expert coding, interoperability, and multiuser skills.
Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.
View products that this article applies to.
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
conn.Execute "COMMIT TRANSACTION"
conn.CommitTrans
Keywords: KB202396, kbpending, kbbug