Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / February 2006

Tip: Looking for answers? Try searching our database.

Get File Name from Path

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Scott - 23 Feb 2006 04:30 GMT
How can I get just the filename mypic1.jpg from below path? The path can
change to other sub folders, so I'd like to get the text after the last "\".

PATH

C:\data\access\mypic1.jpg
Crystal - 23 Feb 2006 04:59 GMT
Hi Scott,

you can do a reverse search for \
and then take the RIGHT characters from the string for the
filename

dim mPos as integer, mFilename as string
mPos = instrRev(FilePath_variable,"\")

mFilename = right(FilePath_variable,
len(FilePath_variable)-mPos)

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com

> How can I get just the filename mypic1.jpg from below path? The path can
> change to other sub folders, so I'd like to get the text after the last "\".
>
> PATH
>
> C:\data\access\mypic1.jpg
Duane Hookom - 23 Feb 2006 06:09 GMT
Or
Dir(FilePath_Variable)

Signature

Duane Hookom
MS Access MVP
--

> Hi Scott,
>
[quoted text clipped - 21 lines]
>>
>> C:\data\access\mypic1.jpg
Crystal - 23 Feb 2006 07:53 GMT
Hi Duane,

You are so clever!

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com

> Or
> Dir(FilePath_Variable)
Duane Hookom - 23 Feb 2006 15:40 GMT
Your solution is more robust since my solution requires the file to exist.
If there is no file of that spec, the Dir() won't return any value.

Signature

Duane Hookom
MS Access MVP
--

> Hi Duane,
>
[quoted text clipped - 10 lines]
>> Or
>> Dir(FilePath_Variable)
Crystal - 23 Feb 2006 16:56 GMT
Hi Duane,

Thanks ... did I just get a consolation prize ;)

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com

> Your solution is more robust since my solution requires the file to exist.
> If there is no file of that spec, the Dir() won't return any value.
Duane Hookom - 23 Feb 2006 21:08 GMT
No, I think you get the Gold and I get the Silver since I took a short cut
that might lead to a tree or rock.

Signature

Duane Hookom
MS Access MVP
--

> Hi Duane,
>
[quoted text clipped - 11 lines]
>> exist. If there is no file of that spec, the Dir() won't return any
>> value.
Crystal - 24 Feb 2006 01:42 GMT
you are funny, Duane ;)  and you must be a skiier too ;)

I am happy you posted that -- it is something else to think
about...

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com

> No, I think you get the Gold and I get the Silver since I took a short cut
> that might lead to a tree or rock.
Scott - 24 Feb 2006 00:10 GMT
thx.

> Hi Scott,
>
[quoted text clipped - 21 lines]
>>
>> C:\data\access\mypic1.jpg
Crystal - 24 Feb 2006 01:43 GMT
you're welcome, Scott ;)  happy to help

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com

> thx.
>
[quoted text clipped - 23 lines]
>>>
>>>C:\data\access\mypic1.jpg
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.