2

There is a MS Access application with tables on MS SQL Server linked through ODBC. When connection is lost i receive ODBC error 3146. After connection is restored physically i still receive ODBC 3146 errors. I have to make something like a reconnect to server. How can i do this in MS Access?

2 Answers 2

3

I think all you need to do is refresh the table links. Are you asking how to relink the tables programmatically? Have you tried refreshing the links after being disconnnected and verified that it solves the problem? Refreshing the link in VBA would be something like

Dim db as Database
Set db = Currentdb()
db.TablesDefs(1).RefreshLink

You may have to loop thru the tables to get the index I am not sure if it will take the table name but you could try it that way first.

2
  • Thanks for answer. Yes, this is very useful information, but first of all i need to understand what exactly solves connection problem with ODBC - is there any special method of application like connection.reconnect or .close then .open. Project has about 180 linked tables so refreshing link each of them will take much time. Is there another way to reconnect?
    – host.13
    Mar 27, 2013 at 20:21
  • Why do you have 180 linked tables? If there are tables with similar columns, you can simply relate those columns with other tables, if I am correct. Jun 5, 2015 at 6:06
0

Where is your Access table in reference to your SQL Server? If your Access table is local and you are the only one using it then refreshing table links is sufficient. However, if the Access db lives on a server or some other shared space where many people are using it they will not be able to access the SQL tables if you are using a USER DSN. Setting up a system DSN or a dsn file will provide Access with the information it is looking for as to where the SQL tables are.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.