This is a simple example...
Dim cn As ADODB.Connection
Dim sSQL As String
On Error GoTo Proc_Err
Set cn = CurrentProject.Connection
cn.BeginTrans
sSQL = "INSERT INTO Shippers (CompanyName, Phone) " & _
"VALUES ('Microsoft','(503) 555-9831')"
cn.Execute sSQL
sSQL = "UPDATE Shippers SET CompanyName = 'Mike Rowe Soft' " & _
"WHERE CompanyName = 'Microsoft'"
cn.Execute sSQL
'Use the next line against SQL Server
sSQL = "DELETE FROM Shippers " & _
"WHERE CompanyName = 'Mike Rowe Soft'"
'Use the next line against Jet (Access)
'sSQL = "DELETE * FROM Shippers " & _
"WHERE CompanyName = 'Mike Rowe Soft'"
cn.Execute sSQL
cn.CommitTrans
Proc_Exit:
On Error Resume Next
cn.Close
Set cn = Nothing
Exit Sub
Proc_Err:
cn.RollbackTrans
MsgBox Err.Number & vbCrLf & Err.Description
Resume Proc_Exit
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia