Solved

changing paths in access

Posted on 1997-08-24
3
325 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
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

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

Suggested Solutions

This article describes some very basic things about SQL Server filegroups.
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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…

895 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

15 Experts available now in Live!

Get 1:1 Help Now