Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

DahMurf (Programmer)
21 Mar 05 15:27
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!
MoLaker (Programmer)
21 Mar 05 15:30
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.
DahMurf (Programmer)
21 Mar 05 16:19
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:

CODE

    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?
MoLaker (Programmer)
21 Mar 05 16:33

CODE

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.
DahMurf (Programmer)
21 Mar 05 16:33
NEVERMIND!!!!!!!!!

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

CODE

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

CODE

    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

DahMurf (Programmer)
21 Mar 05 16:35
Thanks a bunch MoLaker! I guess we were posting at the same time!!!

Deb
MoLaker (Programmer)
21 Mar 05 16:44
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.

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