'データベースに接続
Dim cn As New ADODB.Connection
Set cn = New ADODB.Connection
cn.Open DBLink
'実行したいSQL
Dim strSQL As String
strSQL = "INSERT INTO 猫 (名前, 色) VALUES (たま, 白), (ポチ, 三毛);"
'トランザクションの開始
cn.BeginTrans
cn.Execute strSQL 'INSERT文の実行
cn.CommitTrans
cn.Close
' INSERT前に重複値を検索
Dim rs As ADODB.Recordset
Set rs = cn.Execute("SELECT 名前 FROM 猫 WHERE 名前 IN ('たま', 'ポチ')")
If rs.EOF Then
cn.Execute strSQL
cn.CommitTrans
Else
MsgBox "重複する値が存在します"
cn.RollbackTrans
End If