Stang70Fastback
Registered User.
- Local time
- Today, 03:00
- Joined
- Dec 24, 2012
- Messages
- 132
Hello all. I'll cut to the chase. I have an Access front end and SQL Server back end. I use DSN-less connections to link up all the tables. If the user doesn't have the rights, then I get this error:
and then it displays a small login window with the server info, etc...
I want to avoid all of that. Is there a simple piece of VBA code I can use to simply test whether or not I can connect to my SQL database WITHOUT throwing all these errors? Even if I can't differentiate between the server being DOWN or the user not having permissions, I'd love to just be able to start things off with a generic, "Access cannot reach the server, or you do not have access to this database. Please contact your administrator," error message which would then cleanly quit Access.
I just don't know how to do it without simply trying to call a normal ODBC connection which will then throw that error. All I want is a way to test whether or not they have permissions to access the database. The flip side of the coin might be, can I suppress these errors somehow?
and then it displays a small login window with the server info, etc...
I want to avoid all of that. Is there a simple piece of VBA code I can use to simply test whether or not I can connect to my SQL database WITHOUT throwing all these errors? Even if I can't differentiate between the server being DOWN or the user not having permissions, I'd love to just be able to start things off with a generic, "Access cannot reach the server, or you do not have access to this database. Please contact your administrator," error message which would then cleanly quit Access.
I just don't know how to do it without simply trying to call a normal ODBC connection which will then throw that error. All I want is a way to test whether or not they have permissions to access the database. The flip side of the coin might be, can I suppress these errors somehow?