Results 1 to 11 of 11
  1. #1
    securitywyrm is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    97

    How to handle changing drive letters in table references?

    SOLUTION FOUND: https://www.itworld.com/article/2694...n-windows.html . If it's looking in the Y drive which doesn't exist for things in the S drive, I just create a "Net use S: Y:" to create a phantom Y drive that takes it to the correct location.

    I'm trying to build a database for people both at home (telework) and at the office to use. However there's a big issue with the location of the data people are pulling from. For those at the office, the location is Y:\Education\Databases . For those at home, it's S:\Education\Databases . As I built this at work, the database won't work for those at home because it's looking for the Y drive.


    Current options
    1. Create a separate version of the forms file for home and work. This would be very difficult to maintain version control, because I effectively have to double my work when I do upgrades.


    2. Find a way to have the linked files search multiple locations
    3. Have the linked file location involve "currentpath" somehow and keep all the forms in the same folder.

    Advice would be appreciated!

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    NEVER use drive letters, use the full path.

  3. #3
    securitywyrm is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    97
    What do you mean by "full path"? So y:\Education\databases\fiscaldata.acdb ?

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936

  5. #5
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Drive letters are really just shortcuts to the network file path. You can assign any drive letter to any network path. He is saying to use the network path.
    If you look at the drive in Windows Explorer, it will show you what the full network path is.

  6. #6
    securitywyrm is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    97
    Quote Originally Posted by JoeM View Post
    Drive letters are really just shortcuts to the network file path. You can assign any drive letter to any network path. He is saying to use the network path.
    If you look at the drive in Windows Explorer, it will show you what the full network path is.
    When I created the links I navigated the file structure to the relevant file and double clicked. Where would I go to put in the 'network path'?

  7. #7
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    In File Explorer, the path is usually listed next to the letter. Open a second File Explorer and type in the path as it is written and navigate to your folder. Then copy the path as it is.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    'Full path' is also called UNC - Universal Naming Convention - path.

    I use a VBA procedure to rename links with UNC path.

    Code:
    Public Sub NormalizeTableLinks()
    'Relink tables with UNC pathing
    'Use the variables provided to do the manipulations desiredDim td As TableDef
    Dim db As DAO.Database
    Dim strOld As String
    Dim strNew As String
    'replace the following strings as needed
    strOld = "old path"
    strNew = "new path"
    Set db = CurrentDb
    For Each td In db.TableDefs
        If InStr(td.Connect, strOld) > 0 Then
            Debug.Print td.Name
            Debug.Print "Old Link: " & td.Connect
            td.Connect = Replace(td.Connect, strOld, strNew)
            td.RefreshLink
            Debug.Print "New Link: " & td.Connect
        End If
    Next td
    db.TableDefs.Refresh
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    Quote Originally Posted by June7 View Post
    'Full path' is also called UNC - Universal Naming Convention - path.

    I use a VBA procedure to rename links with UNC path.

    Code:
    Public Sub NormalizeTableLinks()
    'Relink tables with UNC pathing
    'Use the variables provided to do the manipulations desiredDim td As TableDef
    Dim db As DAO.Database
    Dim strOld As String
    Dim strNew As String
    'replace the following strings as needed
    strOld = "old path"
    strNew = "new path"
    Set db = CurrentDb
    For Each td In db.TableDefs
        If InStr(td.Connect, strOld) > 0 Then
            Debug.Print td.Name
            Debug.Print "Old Link: " & td.Connect
            td.Connect = Replace(td.Connect, strOld, strNew)
            td.RefreshLink
            Debug.Print "New Link: " & td.Connect
        End If
    Next td
    db.TableDefs.Refresh
    End Sub


    In your VBA is "old link" and "new link" the actually paths or is that how the script reads. I'm not VBA savey and usually just copy and paste the script.

  10. #10
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You would substitute your actual paths in where "old path" and "new path" are shown in the code.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Paths will have the following structure:

    oldPath would be the old drive letter reference, like: "C:\folders path here\dbname.accdb"

    newPath would be the UNC reference, like: "\\servername\folders path here\dbname.accdb"

    Again, substitute with real names as needed. Review posts 3 and 4. A drive letter mapping can represent a location deep in the file structure so it is not a direct replacement of "C:" with "\\servername". Have to define the 'full path' after the servername.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How do I handle Duplicate members in a table?
    By KingOf206 in forum Access
    Replies: 5
    Last Post: 10-11-2015, 07:44 AM
  2. how do I handle a changing lookup table?
    By jrg24 in forum Access
    Replies: 6
    Last Post: 06-03-2015, 03:47 PM
  3. need code to copy one file from C drive to E drive
    By ChuckRS in forum Programming
    Replies: 5
    Last Post: 02-23-2015, 07:27 AM
  4. Composite key references same table
    By Bangsadrengur in forum Reports
    Replies: 0
    Last Post: 08-04-2011, 05:46 AM
  5. Is this the best way to handle changing records?
    By teresamichele in forum Access
    Replies: 17
    Last Post: 02-14-2011, 09:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums