How to retrieve/display ODBC errors

  • Thread starter Thread starter Jim Shipley
  • Start date Start date
J

Jim Shipley

Is there a way to display the SQL Server ODBC errors in an error message?

For instance, if the user tries to insert a duplicate key record, SQL will
respond with a descriptive error message, "INSERT failed........" How do
you display this message? Err.Description just reports 'ODBC Call
failed...'

Thanks
Jim Shipley
 
Jim Shipley said:
Is there a way to display the SQL Server ODBC errors in an error
message?

For instance, if the user tries to insert a duplicate key record, SQL
will respond with a descriptive error message, "INSERT
failed........" How do you display this message? Err.Description
just reports 'ODBC Call failed...'

Thanks
Jim Shipley

The DBEngine object has an Errors collection that lists the complete set
of errors from the most recent failed operation. There may be more than
one error in the collection, all arising from the same operation; for
example, Errors(0) may be "INSERT failed ..." and Errors(1) may be "ODBC
call failed ...". The Errors collection is documented in the DAO help
file.
 
Thanks I'll try that!
Jim

Dirk Goldgar said:
The DBEngine object has an Errors collection that lists the complete set
of errors from the most recent failed operation. There may be more than
one error in the collection, all arising from the same operation; for
example, Errors(0) may be "INSERT failed ..." and Errors(1) may be "ODBC
call failed ...". The Errors collection is documented in the DAO help
file.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top