How do I capture an error message from SQL server in an MS Access form?

My table in SQL Server has a unique contraint. So when I add a duplicate item in an Access form I get an error message from SQL server. If I use the OnError
of Access, I can capture the error but it does not correspond to the error that Access displays without the error handler (eg. [Microsoft][ODBC]...)

I've used DAO, ADO and couldn't capture the error message. It is not stored
in DAO.Errors or ADO.Errors. I need to capture it and display my own messages that is more understandable to the user.