Reporting Linked Table's Connection

ShredDude

Registered User.
Local time
Today, 04:10
Joined
Jan 1, 2009
Messages
71
I've written a routine that facilitates changing the Connections on linked tables in my DB to different backends. This works well.

However, when completed, I'm attempting to report the current connection link in a textbox on a form. On Form Open, prior to making a change, I populate the text box with the following:

Code:
?dbengine.workspaces(0).databases(0).tabledefs("tblEmployees").connect

This works great. Then I make my changes. The new connections appear in the Linnked Table Manager dialog, and through testing i can verify I'm certainly connected to the newly selected back end.

Using the same line of code returns the original connection however, until I close the DB and reopen it, something I'm trying to avoid. I want to update the textbox on the form with what I can see in the Linked Table Manager dialog, but I can't seem to extract it with code.

Any suggestions on how to accurately report a linked table's connection after it's been changed without closing the DB and reopening?

Thanks,
Shred
 
you probably need to refresh the links. so for instance:

Code:
tabledefs("tblEmployees").RefreshLink
 
Thanks for the reply.

My routine does refresh the links. Post routine, the changes are visible in the Linked Table Manager's dialog window.

After more tinkering, I discovered that this code does return the correct link definition:

Code:
currentdb.tabledefs("tblEmployees").connect

Still don't understand why the other code doesn't reflect the change. This line will still return the original link(s) prior to the routine changing them:

Code:
dbengine.workspaces(0).databases(0).tabledefs("tblEmployees").connect

Still new to Access. Just trying to figure it out. Any ideas on what the difference is. I'm missing something.
 

Users who are viewing this thread

Back
Top Bottom