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

How do I open the Linked Table Manager from a button?

Status
Not open for further replies.

ThornPCC

Programmer
Jan 6, 2000
26
US
Hi,

I have a database that uses many linked text files and dbf files. The files are updated many times a day, and I'd like to have their links updated everytime I run the database.

I know how to run the Linked Table Manager myself, but some of the other users aren't too computer literate.

Thanks.



Phil
Thorn@full-moon.com

Most of us go through life not knowing what we want, but feeling damned sure that this isn't it.

 
try this code, see if it does what you want

Public Function fRefreshAll()
Dim db As DAO.database, rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("MsysObjects", dbOpenSnapshot)
With rst
.MoveFirst
Do While Not .EOF()
If rst!Type = 6 Then 'Linked Table
db.TableDefs(rst!Name).Connect = ";Database=" & rst!database
db.TableDefs(rst!Name).RefreshLink
ElseIf rst!Type = 4 Then 'ODBC Table And Password Saved in Connect String
db.TableDefs(rst!Name).Connect = ";odbc=" & rst!Connect
db.TableDefs(rst!Name).RefreshLink
End If
.MoveNext
Loop
End With
MsgBox "Done"
Set db = Nothing
Set rst = Nothing
End Function

PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top