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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically Link Back End Database

Status
Not open for further replies.

wirelessben

Programmer
Mar 23, 2004
20
0
0
US
How can I dynamically link the back end of an Access 2000 database?

The database has one front end and two back ends.

I want to give the user the option of choosing between two data sets residing on the same computer.

The link table manager will only set up static linkages to external tables.

 
You will need a reference to DAO to use below code

Set Db = CurrentDb()
DoCmd.Hourglass True
lblProgress.Visible = True
For i = 0 To Db.TableDefs.Count - 1
lblProgress.Caption = "Relinking " & i + 1 & " of " & Db.TableDefs.Count
DoEvents
Set tdf = Db.TableDefs(i)
If tdf.Connect <> "" Then
j = InStr(1, UCase(tdf.Connect), "DATABASE=")
k = InStr(1, UCase(tdf.Connect), "TABLE=")
strConnect = Left(tdf.Connect, j + 8) & txtDataMDB & ";Table=" & tdf.Name
tdf.Connect = strConnect
tdf.RefreshLink

End If
Next i
lblProgress.Visible = False
DoCmd.Hourglass False
Set Db = Nothing

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ken,

You are a super duper VB trooper. It works great. Thanks.

Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top