Solved

changing paths in access

Posted on 1997-08-24
3
332 Views
Last Modified: 2012-06-27
I'm using access in office-95 and have setup a database. Now I'd like to ship it to a client, but the problem is their drive and path are different on the client side than when I created them. How can I change them from machine to machine ?
0
Comment
Question by:amirmansour
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:ronabb
ID: 1025236
Firstly, it's a good idea to try to get all of your systems installed into the same directory, so the problem does not arise.It's the disk letter that's usually the problem.  I set up a scheme whereby the program looks for a file called FILEOND.DAT and then deletes it's attached tables and reattaches them to the D drive in the "standard" directory. Same with FILEONE.DAT for the E: drive.
You can delete and reattach in code after determining that the info in the attach string is wrong.
Or you can do this with macros. use the DIR$ function to see if the file exists and use the length of the result (LEN(DIR$("FILEOND.DAT"))>0 to delete the attached tables and reattach them with the TransferDatabase action.
let me know if you need more.
0
 

Author Comment

by:amirmansour
ID: 1025237
It's not just the drive letter, it's the full path. The client could have installed it anywhere and to link to their tables, the path must be variable. To make matters even worse, they could have multiple data paths.
So I need to know how to change the the full path, not just the drive letter.

0
 
LVL 3

Accepted Solution

by:
chapie earned 50 total points
ID: 1025238
Eventhough a programmitic chaning of linked tables shouldn't be considered easy, here's the begginings of a solution you are seeking.  Gook luck.

Public Function ap_LocateBackend(dbLocal, dynSharedTables, strCurrError) As Boolean
Dim ocxDialog As Object

ap_LocateBackend = True

DoCmd.Echo True
Beep

If MsgBox("A problem has occurred accessing the linked tables." & _
     vbCrLf & vbCrLf & "The error was: " & strCurrError & vbCrLf & _
     vbCrLf & "Would you like to locate the backend?", vbCritical + _
     vbYesNo, "Error with Backend") = vbYes Then
   
   Set ocxDialog = Screen.ActiveForm!ocxDialogControl.Object
   
   With ocxDialog
      .FileName = gstrBackendName
      .InitDir = gstrAppPath
      .DialogTitle = "Please Locate " & gstrBackendName
      .Filter = gstrBackendName
      .CancelError = True
      .ShowOpen
   End With
   
   If Err.Number <> apErrComDlgCancel Then
      DoEvents
      ap_LinkTables dbLocal, dynSharedTables, ocxDialog.FileName
      gstrBackEndPath = Left$(ocxDialog.FileName, ap_LastInStr(ocxDialog.FileName, "\"))
   Else
      ap_LocateBackend = False
   End If
Else
   ap_LocateBackend = False
End If
   
Exit_ap_LocateBackend:
    Exit Function
Error_ap_LocateBackend:
    ap_LocateBackend = False
    Resume Exit_ap_LocateBackend
End Function
0

Featured Post

Webinar: Security & Encryption in the MySQL world

Join Percona’s Solutions Engineer, Dimitri Vanoverbeke as he presents “Security and Encryption in the MySQL world” on Thursday, July 6, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

695 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