Tuesday, 20 August 2013

Catching Microsoft Access ODBC connection errors to SQL Server linked tables

Catching Microsoft Access ODBC connection errors to SQL Server linked tables

I have a little Access application with linked tables to SQL Server that I
use at a couple different sites so the SQL server names and sometimes the
SQL database and odbc connection names are different from site to site.
However they use the Access Runtime to use it so don't have the ability to
relink tables without the full version. I'm struggling to find a way to
catch any ODBC connection errors and then offering them the option to
relink the tables by typing in the ODBC connection name etc. and then
relinking through VBA code which I believe is possible.
(http://www.access-programmers.co.uk/forums/showthread.php?t=143180 for
example)
The database loads immediately on a form with a record source on a linked
table so it needs to catch the error on that form if possible. I guess I
can add a main menu with a button to relink tables there but would prefer
avoiding introducing a menu form which requires an extra click for users.
Have found these articles but I'm unable to catch the initial odbc failure
to connect in the form's On Error event and have tried the Activate event
as well. Any suggestions would be highly appreciated!
http://support.microsoft.com/kb/209855
http://www.access-programmers.co.uk/forums/showthread.php?t=198039

No comments:

Post a Comment