The following function returns an error string for any valid error number:
Function ErrorString(lngError As Long) As String
Const conAppError = "Application-defined or "
& "object-defined error"
On Error Resume Next
Err.Raise lngError
If Err.Description = conAppError Then
ErrorString = AccessError(lngError)
ElseIf Err.Description = "" Then
MsgBox "No error string associated with this number."
Else
ErrorString = Err.Description
End If
End Function