File path and name

  • Thread starter Thread starter anna_717717
  • Start date Start date
A

anna_717717

Hi, all. Hope someone can help.

I've been using the code found at the link below to browse for a image and
then input the file name into a textbox on a form.

http://www.mvps.org/access/api/api0001.htm

Is it possible to split up, or call for separately, the path name and file
name so that I could modify path name if the location of the images changes.

Thanks
 
Here are two functions:

Function getpath(Filename As String) As String
getpath = (Mid(Filename, 1, Len(Filename) - Len(Dir(Filename))))
End Function

Function getfile(Filename As String) As String
getfile = (Mid(Filename, Len(Filename) - Len(Dir(Filename)) + 1))
End Function


--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
hi Anna,

anna_717717 said:
Is it possible to split up, or call for separately, the path name and file
name so that I could modify path name if the location of the images changes.
The last backslash separates path from file, e.g.

Dim a() As Long
Dim File As String
Dim Path As String

a() = Split(yourPathAndFile, "\")
File = a(UBound(a()))
Path = Left(yourPathAndFile, Len(yourPathAndFile) - Len(File))


mfG
--> stefan <--
 
Back
Top