Excecute Error Handler before default SQL Server Error

  • Thread starter Matt.W.Stephens
  • Start date
M

Matt.W.Stephens

I have an Access frontend that connects to an SQL Server backend. The
database opens a switchboard on open and the switchboard calls the SQL
Server for its contents. The problem I am having is when the user does
not have access to the SQL Server I need to catch the SQL Server Error
(which is alwasy 18456) and displaying my Error Handler Message before
the default error box pops up and asked the user about Trusted
Connections and so forth. My Error Handler looks like this

ErrorHandler:
If Err.Number = 3151 Then
MsgBox "To access this database, you must " & vbCr & _
"complete an IS request for access to" & vbCr & _
"database 'MYDATABASE' on server MYSERVER", vbCritical,
"You do not have access to this database"
DoCmd.Quit
Else
MsgBox Error$, vbCritical, "Error number " & Err.Number
End If


Is it possible to prempt the default SQL Server Error message?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top