Solved

changing paths in access

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need a starter for ETL protocol? 4 65
Error Creating Foreign Keys in SQL Database 7 45
constraint check 2 48
ORA-02288: invalid OPEN mode 2 56
Read about achieving the basic levels of HRIS security in the workplace.
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
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…

856 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