Solved

changing paths in access

Posted on 1997-08-24
3
317 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Often, when running a query with joins, the results show up "duplicates", and often, those duplicates can be "eliminated" in the results using DISTINCT, for example. Using DISTINCT is simple: just add it after the SELECT keyword, an…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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…

772 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

10 Experts available now in Live!

Get 1:1 Help Now