Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access2 Attached Tables Pathing on Network

Posted on 1997-11-05
2
Medium Priority
?
243 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 400 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

885 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