Solved

Access2 Attached Tables Pathing on Network

Posted on 1997-11-05
2
201 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

757 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

21 Experts available now in Live!

Get 1:1 Help Now