FredixBlog


Just my log about anything I could find enjoyable.



Splitting File and Path of folder: NoPath() & FilePath()

author Posted by: fredometro on date Jan 1st, 2004 | filed Filed under: MS-Access

Nopath() function returns the filename without the path.
Its little sister, FilePath, returns the path without the filename.

 

Public Function NoPath(TheText)
Dim ch, result As String
Dim pos As Integer
pos = Len(TheText)
While ch <> “\” and pos > 0
    ch = Mid(TheText, pos, 1)
    result = ch & result
    pos = pos - 1
Wend
NoPath = Right(result, Len(result) - 1)
End Function

Public Function FilePath(ThePath)
Dim result As String
result = Left(ThePath, Len(ThePath) - Len(NoPath(ThePath)))
FilePath = result
End Function