Solved

Access2 Attached Tables Pathing on Network

Posted on 1997-11-05
2
210 Views
Last Modified: 2006-11-17
We are running an MS ACCESS 2 application where the data is stored in a separate database from the "front end".  The "front End" (Run Time version) is installed on each work station while the data mdb is to be installed on a LAN.  The tables from the data.mdb are attached to the front end mdb and are shared among multiple users.  Rather than installing the data.mdb by pathing it to a specific drive (ie H:\directory\data.mdb) we have been told to use the universal naming convention (UNC) to identify a specific location on the LAn (ie \\Server_name\location\directory\application) without identifying a specific drive letter.  Can this be done in Access 2.  If so, HOW do we do it?!!  Any assistance would be greatly appreciated!
0
Comment
Question by:director
2 Comments
 
LVL 2

Accepted Solution

by:
innovate earned 100 total points
ID: 1958741
Hi director,

There are two ways of achieving this.

1) manually
2) Code (New attach or re-attach same or new location)

1)

First share your directory (resource) on the source machine (data)
In these examples the machine will be PC1 and share name Share1.

From the file menu select Attach Table.
Select Microsoft Access.
In the File name Dialogue box type the full UNC path to the Access database like

\\PC1\Share1\DbName.mdb

Then press OK.  IF you've got the path name right this will work fine and you can select the desired table.

In code

Use transfer database or the Connect property

TransferDatabase
Function attach ()
Dim strDatabase As String, strTable As String

strDatabase = "\\PC1\Share1\DbName.mdb"
strTable = "Mytable"

DoCmd TransferDatabase A_Attach, "Microsoft Access", strDatabase, A_TABLE, strTable, strTable

End Function

Re-attach an exisitng table using UNC's

Function reAttach ()
Dim db As Database, td As TableDef

Dim strDb As String, strTable As String

strDb = "\\PC1\Share1\DbName.mdb"
strTable = "Mytable"

Set db = CurrentDB()
Set td = db.Tabledefs(strTable)

td.Connect = ";Database=" & strDb & ";TABLE=" & strTable

Set td = Nothing
db.Tabledefs.Refresh
Set db = nothing

End Function

Enjoy
0
 

Author Comment

by:director
ID: 1958742
Thanks for your help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now