ODBC errors need to return more information error 3146 does not provide enough detail
Perhaps an error.description2 property which we can reference which stores the error returned from SQL about the true problem. Right now it is very difficult to trouble shoot.
Ben Sacheri commented
I'm out of votes but I would like to have more descriptive error messages.
Mark Jaskula commented
I can confirm Anders comment, it's a fantastic titbit particularly when you get referential integrity errors and want to know the culprit easily.
Mark Burns commented
Your posted Link is now broken.
Any chance that you have a better one?
B. Clothier commented
FYI - there is also this known issue that is a *big* PITA... From an old KB article..
(note that the title is misnamed - it says "OnOpen" but it's actually referring to "OnError".
Addressing this pain point would go a long way toward making it easier to handle ODBC errors.
Anders Ebro (TheSmileyCoder) commented
Not commonly known, there is a Errors collection. Now I only know of one case where the Errors collection contains more than 1 error, and that is for ODBC errors. So my error handler takes special care of that situtation with the below code:
'Special case for ODBC errors.
If Err.Number = 3146 Then
Dim i As Integer
For i = 0 To Errors.Count - 1
strErrDescription = strErrDescription & vbNewLine & "ODBC:" & Errors(i).Number & " - " & Errors(i).Description
That usually gives enough information to track down the underlying issue just fine.
I hope that helps.