File path and name

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
 
R

Roger Carlson

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
 
S

Stefan Hoffmann

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 <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top