Solved

Access2 Attached Tables Pathing on Network

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Office 365 home questions 7 65
Delete QueryDef IF it Exists: Access VBA 5 36
Dirty form - conditional formatting 5 27
Help with MS Access search Form 7 14
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

803 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