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/209855http://www.access-programmers.co.uk/forums/showthread.php?t=198039
Sounds like that could work thank you, will have a go and report back
Works an absolute charm thank you so much!For future readers here's my final code for extracting the connection string and stripping off the ODBC: from the front: strConnect = CurrentDb.TableDefs("tablename").Connect strConnect = Right(strConnect, Len(strConnect) - 5)
ebooyens That's good to hear, thanks.I updated answer to use Mid to extract the needed part from the TableDef.Connect property.