Max Wanadoo
max.wanadoo at gmail.com
Sun Jan 17 04:38:45 CST 2010
Sorry, replied in haste Doug. Twice is correct for FOLDER name. Function Filename() Dim str As String str = "c:\dir\subdir2\myfile.txt" 'str = "me" str = Mid(str, InStrRev(str, "\") + 1) Debug.Print str End Function Function Foldername() On Error Resume Next Dim str As String str = "c:\dir\subdir2\myfile.txt" ' gives subdir2 'str = "myfile" 'gives myfile str = Left(str, InStrRev(str, "\") - 1) str = Mid(str, InStrRev(str, "\") + 1) Debug.Print str End Function Max -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Doug Murphy Sent: 17 January 2010 01:15 To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Simple String Help Use instrRev twice searching on "\" should do it. On the first one trim off the file name. On the second get the foldername. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Robert Sent: Saturday, January 16, 2010 4:06 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Simple String Help I know this should be easy, but for some reason today I just can't come up with a working solution.. The Goal: To evaluate a string (path) and return only the end (last folder name). This string could end differently with or without "\" Example: "\\adfs\ad_folder\sxpdata\Word Docs\" OR "\\adfs\ad_folder\sxpdata\Word Docs OR C:\ad_folder\sxpdata\Word Doc\ Need to return only the "Word Docs" portion I'm drawing a blank here.... WBR Robert -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com