Results 1 to 8 of 8
  1. #1
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Path syntax (2003 sp2)

    When refering to a file in one of my procedures I use something like "M:TOP Technical ServicesDatabaseSomeFile". Of course "M" is a network drive. The problem is the same drive used by another department is designated "R" so when the user in that department runs the procedure they get an error. The Novell prefix to the drive is "Tos on 'Ppnwws07Vol1GroupPa'" regardless of the letter assigned. Is there a way to use that in the path syntax? I have tried some variations and get the same error, Path not Found.

    Any suggestions?
    Thanks
    chuck

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Path syntax (2003 sp2)

    Does this work?

    "'Ppnwws07Vol1GroupPaTosTOP Technical ServicesDatabaseSomeFile"

    Note the double backslash at the beginning.

  3. #3
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Path syntax (2003 sp2)

    No it does not. Did you intend the single quote after the double quote at the beginning of the path? I did try as you had written and with the single quote removed.
    Thanks
    chuck

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Path syntax (2003 sp2)

    No, the single quote was a mistake in copying/pasting.

    I'd ask your network admin - he or she can undoubtedly tell you what the UNC path of your M: drive is.

    Or run this little procedure:

    Sub ShowUNC()
    Dim objDrives As Variant
    Dim strDriveName As String
    Dim i As Integer

    strDriveName = "M:"
    Set objDrives = CreateObject("WScript.Network").EnumNetworkDrives
    For i = 0 To objDrives.Count - 1 Step 2
    If objDrives(i) = strDriveName Then
    Debug.Print objDrives(i + 1)
    Exit For
    End If
    Next i
    End Sub

    It should show the UNC path for the M: drive in the Immediate window.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Path syntax (2003 sp2)

    Great! (Apart from the misplaced single quote, that appears to be identical to what I proposed in my first reply)

  6. #6
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Path syntax (2003 sp2)

    Your procedure yeilded PPNWWS07VOL1GROUPPATOS. I plugged it in and it worked. Many thanks.

    The education I am getting here is priceless.
    Thanks
    chuck

  7. #7
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Path syntax (2003 sp2)

    Big Oops on me. I missed the TOS on your first reply. Very sorry. But I really like that procedure.
    Thanks
    chuck

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Path syntax (2003 sp2)

    The procedure was tailored for this situation. If you'd like to use it more often, you can change it to a function with an argument:
    <code>
    Function ShowUNC(strDriveName As String) As String
    Dim objDrives As Variant
    Dim i As Integer

    Set objDrives = CreateObject("WScript.Network").EnumNetworkDrives
    For i = 0 To objDrives.Count - 1 Step 2
    If objDrives(i) = strDriveName Then
    ShowUNC = objDrives(i + 1)
    Exit For
    End If
    Next i
    End Function
    </code>
    You can type
    <code>
    ? ShowUNC("P:")
    </code>
    in the Immediate window to see the UNC path of the P: drive, and you can use it in your code:
    <code>
    Dim strDrivePath As String
    Dim strUNC As String
    strDrivePath = "L:CommonTest.mdb"
    strUNC = ShowUNC(Left(strDrivePath, 2))</code>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •