I looked at many posts regarding linking tables or refreshing links via
code, but none seemed to address my particular situation (which surprised
me).
I have a development PC and need to distribute a Front End/Back End db to
several different locations. Each will have a different UNC path to their
own shared folder in which the Back End resides. How can I pre-set the
links with the right address before distributing the application? The end
product FrontEnd is a .mde file with no menus, and I don't really feel safe
having the users use the LTM and then create mde's themselves.
Is this possible?
Thanks for reading, and for any help
TomU - 16 Mar 2005 21:33 GMT
Take a look at Dev Ashish's re-link code here:
http://www.mvps.org/access/tables/tbl0009.htm
In this code the path to the linked table comes from a Windows dialog but
you could modify it to come from a table that is internal to your FE.
Assuming you know the proper paths for all your users, you could pre-load the
path to each user's BE database.
TomU
> I looked at many posts regarding linking tables or refreshing links via
> code, but none seemed to address my particular situation (which surprised
[quoted text clipped - 10 lines]
>
> Thanks for reading, and for any help
rgrantz - 17 Mar 2005 19:29 GMT
Is this the only way to do this? That seems like a lot of code, and after
spending about an hour trying to get it to work, I was hoping that maybe
there's just some smaller code snippet that I can run once that sets the
path, database name, and tables to link to. I don't need to prompt for the
path or table names or anything, I'll know ahead of time, and would like (if
possible) to be able to set the links before making a .mde.
Thanks for the help
> Take a look at Dev Ashish's re-link code here:
> http://www.mvps.org/access/tables/tbl0009.htm
[quoted text clipped - 20 lines]
> >
> > Thanks for reading, and for any help
Andy - 17 Mar 2005 22:29 GMT
I have developed a LinkTables module which you are welcome to use. It is
form driven, uses CommonDialog, table names and databases are pre-stored.
It's yours for the asking (hiestand@kgexpress.net)
Andy
> Is this the only way to do this? That seems like a lot of code, and after
> spending about an hour trying to get it to work, I was hoping that maybe
[quoted text clipped - 47 lines]
>>>
>>>Thanks for reading, and for any help
Scott McDaniel - 25 Mar 2005 15:08 GMT
Another option, if you know the hardcoded path to the endusers tables, is to
mimic their setup on your own network.
Alternatively, you can do this:
Function RefreshLinks(strFileName As String) As Boolean
' Refresh links to the supplied database. Return True if successful.
Dim dbs As Database, tdf As TableDef
' Loop through all tables in the database.
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
If Len(tdf.Connect) > 0 Then ' If the table has a connect string
tdf.Connect = ";DATABASE=" & strFileName
Err.Clear
On Error Resume Next
tdf.RefreshLink ' Relink the table.
If Err <> 0 Then Exit Function
End If
Next tdf
RefreshLinks = True ' Relinking complete.
End Function
This came from the Solutions.mdb database that ships with access ...
"FileName" is the path to the backend files. It probably could use some
polishing, but it'll do what you want.
------------------------------?---------------
>I looked at many posts regarding linking tables or refreshing links via
> code, but none seemed to address my particular situation (which surprised
[quoted text clipped - 11 lines]
>
> Thanks for reading, and for any help