Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Jobs from Indeed

VB Code to link backend tables to frontend?

VB Code to link backend tables to frontend?

I want to link my frontend to my backend tables using VB. I want to do this when I open the database and then drop the link when I close the database. I am only using Access 2000 for both the frontend & backend.

I've seen a lot of posts saying you should do this & I've seen several with examples of linking to tables other then in Access. I've tried to do research & read the help but I'm still lost.

Could someone post an example of code used to do this for Access only?

Thanks in advance!

RE: VB Code to link backend tables to frontend?

Look up DoCmd.TransferDatabase in Access Help.  One option is "acLink".  Just make sure you delete the link before you attempt to relink or you will wind up with table, table1, table2, etc.

RE: VB Code to link backend tables to frontend?

Thanks! That helped to a point. I'm still not getting it correct tho. I saw that I could do the link in a Macro so I tried it just to see if I could make it work and of course it did. When I go back to my code I can't get it to work.

This is what I have coded:


    Dim bePath As String
    bePath = "c:/aa_share/ecta/Test_Development_be.mdb"
    DoCmd.TransferDatabase acLink, "Microsoft Access", _
    bePath, acTable, tbl_membership, tbl_membership

Can anyone tell me where I'm going wrong?

RE: VB Code to link backend tables to frontend?


Dim bePath As String
bePath = "c:/aa_share/ecta/Test_Development_be.mdb"
DoCmd.TransferDatabase acLink, "Microsoft Access", _
bePath, acTable, "tbl_membership", "tbl_membership"

The table names s/b within quotes.  As for using a variable for the DB path, I guess it will work.  But, if you still have trouble, try using the path string (with quotes) intead of the variable.

RE: VB Code to link backend tables to frontend?


Here's two ways that work!
(There's a reason why I ask for examples!!! I'm usually just missing something small!)


    DoCmd.TransferDatabase acLink, "Microsoft Access", _
    "c:/aa_share/ecta/Test_Development_be.mdb", _
    acTable, "tbl_membership", "tbl_membership"


    Dim bePath As String
    Dim beTable As String
    bePath = "c:/aa_share/ecta/Test_Development_be.mdb"
    beTable = "tbl_membership"

    DoCmd.TransferDatabase acLink, "Microsoft Access", _
    bePath, acTable, beTable, beTable

RE: VB Code to link backend tables to frontend?

Thanks a bunch MoLaker! I guess we were posting at the same time!!!


RE: VB Code to link backend tables to frontend?

Your efforts gave me an idea I had never considered (even if the need has never arisen).

By assigning the path and table names to variables as you have done, I was picturing the ability to open a workspace and list the tables in the back-end using the tables collection.  Then use that list to create the links.  This would make it feasible to add tables to the back-end and have the front-end link to the new tables automatically w/o any change in code.  Hmmmm.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close