Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto-Opening Linked SQL Server tables in Access

Status
Not open for further replies.

jcg6

Technical User
Feb 18, 2002
50
US
I would like my Access database to automatically open the links to my SQL Server database when it opens. Usually you have to click on the table to activate the connection, but I want to proceed this. Does anyone know of a way I can do this with VBA?

I'm basically looking for a way to refresh the previously linked tables on open. Thanks for you help.
 
hmm... why? I've only done one database that links to SQL server data.. but I didn't have to do anything special to refresh the data. There are ODBC refresh settings in TOOLS:OPTIONS:ADVANCED.
 
Some of our users are having problems connecting to the linked SQL tables on opening up the database application - because of the network security we have setup. I want the links to open before they attempt to query any data, so that they don't get timed out. It does sound strange, but it would definitely help me.

I basically want to write code that will do the same thing as the linked table manager. Thanks for your input.
 
No problem, here's the linked table manager code:


Function RefreshLinks() As Boolean
dim CurTDF as tabledef
dim MyDB as database
set mydb = currentdb
for each curtdf in mydb.tabledefs
curtdf.refreshlink
next curtdf
set curtdf = nothing
set mydb = nothing
RefreshLinks = true
End Function

Please add error handling, etc. as you see fit.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top