robtyketto
Board Regular
- Joined
- Oct 25, 2006
- Messages
- 111
Hi All,
My spreadsheet is a front-end for users to execute queries/store procs against SQL server databases and output the rowset(s) to worksheets, this is all working well.
It's the error handling I want to improve, currently my error handling consists of the usual "On error" and displays the vba Error Number and description, which works well in displaying a suitable message when the server is unavailable or an invalid Server or database has been specified in the connection string, the problem I want to specifically capture is if the user doesn't have permission to the database (trusted connection/windows credential based in the connection string).
I've printed both the excel and the ado error details, but if a users don't have permission to a database it's attempting to run a command against it appears to bypass the "On error" error handling and a message box appears displaying the error icon and just the text "5" (from memory) rather than the full details I've specified.
Has anyone experience of specifically capturing/checking error codes related to SQL permissions?
I did read that Excel vba can't capture some Ado errors but found nothing concrete.
My spreadsheet is a front-end for users to execute queries/store procs against SQL server databases and output the rowset(s) to worksheets, this is all working well.
It's the error handling I want to improve, currently my error handling consists of the usual "On error" and displays the vba Error Number and description, which works well in displaying a suitable message when the server is unavailable or an invalid Server or database has been specified in the connection string, the problem I want to specifically capture is if the user doesn't have permission to the database (trusted connection/windows credential based in the connection string).
I've printed both the excel and the ado error details, but if a users don't have permission to a database it's attempting to run a command against it appears to bypass the "On error" error handling and a message box appears displaying the error icon and just the text "5" (from memory) rather than the full details I've specified.
Has anyone experience of specifically capturing/checking error codes related to SQL permissions?
I did read that Excel vba can't capture some Ado errors but found nothing concrete.