Article ID: 161288
Article Last Modified on 3/2/2005
Field ID Description =============================== Record 1 1 Hello Record 2 2 World
Option Explicit
Private Sub Command1_Click()
Dim db As Database
Dim rs As Recordset
On Error GoTo trap
Set db = OpenDatabase("")
Set rs = db.OpenRecordset("Select * from MyTable")
rs.AddNew
rs.Fields(0).Value = 2
rs.Update
Exit Sub
trap:
MsgBox Errors.Count
MsgBox Err.Number & " " & Err.Description
End Sub
' DAO Error Handler
Dim MyError As Error
MsgBox Errors.Count
For Each MyError In DBEngine.Errors
With MyError
MsgBox .Number & " " & .Description
End With
Next MyError
' RDO Error Handler
Dim MyError As rdoError
MsgBox rdoErrors.Count
For Each MyError In rdoEngine.rdoErrors
With MyError
MsgBox .Number & " " & .Description
End With
Next MyError
120763 How to Retrieve Info from RAISERROR Function in SQL Server DB
Additional query words: errors Collection
Keywords: kbhowto kbrdo KB161288