The error message includes each piece of information provided by the Visual Basic Err object except for the LastDLLError value, which does not apply here. The error number tells you which error has occurred. The description is useful in cases in which you do not want to handle the error yourself. You can simply pass it along to the user. Although you will usually want to use messages customized for your application, you cannot anticipate every error; the description gives some clue as to what went wrong. In the sample code, the error was reported by the Connection object. You will see the object's type or programmatic ID here- not a variable name.
When a ADO or DAO error occurs, the Visual Basic Err object contains the error number for the first object in the Errors collection.
ADO エラーまたは DAO エラーが発生すると、Visual Basic の Err オブジェクトには、 Errors コレクションの最初のオブジェクトのエラー番号が含まれます。
Microsoft Access provides three objects that contain information about errors that have occurred, the ADO Error object, the Visual Basic Err object, and the DAO Error object.
The Visual Basic Err object only contains information about the most recent error. The ADO Errors collection of the Connection object contains one Error object for each error raised by the most recent ADO the Errors collection rather than the Err object to handle multiple errors. For more information about the Errors collection, see Provider Errors. However, if there is no valid Connection object, the Err object is the only source for information about ADO errors.
The ADO Error object is quite similar to the standard Visual Basic Err object. Its properties describe the error addition to the number of the error, you also receive two related pieces of NativeError property contains an error number specific to the provider you are using. In the previous example, the provider is the Microsoft OLE DB Provider for SQL Server, so NativeError will contain errors specific to SQL Server. The SQLState property has a five-letter code that describes an error in a SQL statement.
ADO Error オブジェクトは、標準の Visual Basic Err オブジェクトによく似ています。発生したエラーの情報は、プロパティによって表されます。エラーの番号以外に、2 種類の関連情報も返されます。NativeError プロパティには、使用しているプロバイダに固有のエラー番号が格納されます。前の例では、プロバイダは Microsoft OLE DB Provider for SQL Server であるため、NativeError には SQL Server に固有のエラーが格納されます。SQLState プロパティには、SQL ステートメント内のエラーを示す 5 桁のコードが設定されます。
When a ADO or DAO error occurs, the Visual Basic Err object contains the error number for the first object in the Errors collection. To determine whether additional ADO or DAO errors have occurred, check the Errors collection. The values of the ADO Number or DAO Number properties and the ADO Description or DAO Description properties of the first Error object in the Errors collection should match the values of the Number and Description properties of the Visual Basic Err object.
ADO エラーまたは DAO エラーが発生すると、Visual Basic の Err オブジェクトには、Errors コレクションの最初のオブジェクトのエラー番号が含まれます。さらに ADO エラーまたは DAO エラーが発生したかどうかを調べるには、Errors コレクションをチェックします。Errors コレクションの最初の Error オブジェクトの ADO の Number プロパティまたは DAO の Number プロパティ、および ADO の Description プロパティまたは DAO の Description プロパティの値は、Visual Basic の Err オブジェクトの Number プロパティおよび Description プロパティの値に一致する必要があります。
When an error occurs in a procedure with an enabled error handler, Visual Basic doesn't display the normal error message. Instead it routes execution to an error handler, if one exists. When execution passes to an enabled error handler, that error handler becomes active. Within the active error handler, you can determine the type of error that occurred and address it in the manner that you choose. Microsoft Access provides three objects that contain information about errors that have occurred, the ADO Error object, the Visual Basic Err object, and the DAO Error object.
Os exemplos servem apenas como ajuda na tradução da palavra ou da expressão procurada. Eles não são selecionados ou validados por nós e podem conter linguagem inapropriada. Pedimos que reporte exemplos que devem ser modificados ou que não devem ser exibidos. As traduções potencialmente sensivéis, impróprias ou coloquiais geralmente são marcadas em vermelho ou em laranja.