Find the directory part (minus the filename) of a full path in access 97

前端 未结 10 562
太阳男子
太阳男子 2020-12-10 23:38

For various reasons, I\'m stuck in Access 97 and need to get only the path part of a full pathname.

For example, the name

c:\\whatever dir\\another d         


        
10条回答
  •  盖世英雄少女心
    2020-12-11 00:11

    I always used the FileSystemObject for this sort of thing. Here's a little wrapper function I used. Be sure to reference the Microsoft Scripting Runtime.

    Function StripFilename(sPathFile As String) As String
    
    'given a full path and file, strip the filename off the end and return the path
    
    Dim filesystem As New FileSystemObject
    
    StripFilename = filesystem.GetParentFolderName(sPathFile) & "\"
    
    Exit Function
    
    End Function
    

提交回复
热议问题