Linking certain tables from back end database through VBA

  • Thread starter tobesurveyor via AccessMonster.com
  • Start date
T

tobesurveyor via AccessMonster.com

Hello-

I found my answer once when I was beginning my application design, but since
then I have never been able to put my hands on it again and was hoping for
some help.

I have a FE(local) and a BE(On server). At any given time in the FE I want
to link to only specific tables on the BE as decided by which button the user
clicks on the startup form of the FE. A table in the FE will have the path
to the BE and for now want to hard code which tables to link to.

The ideal situation would be to link to those certain tables when the button
is clicked, and then when the user closes out that portion of the FE and
returns to the startup form those linked tables are deleted out of the FE.

Any help would be greatly appreciated.

Thanks,
Chris F.
 
G

Guest

This is certainly going to slow down a user and is a most unusual request;
but, here is the basic syntax to link to a table:


tdf.Connect = ";database=" & Me.datapath
tdf.RefreshLink

tdf is a table definition as
Currentdb.Tabledefs("ATableName")

datapath is the full path to the back end

You can determine whether a table is lined or not with this:
If Len(tdf.Connect) > 0 Then
' Its a linked table. Re-link

To delete a link, you use the DeleteObject method. For linked tables, it
does not delete the table in the back end, just the link to it:

DoCmd.DeleteObject acTable, tdf.Name
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top