Neil- See message: http://groups.yahoo.com/group/ms_access/message/20067?threaded=1 <http://groups.yahoo.com/group/ms_access/message/20067?threaded=1&var=1&p=6> &var=1&p=6 .. for a simpler answer and a useful InStrRev function for A97. John Viescas, author Building Microsoft Access Applications Microsoft Office Access 2003 Inside Out Running Microsoft Access 2000 SQL Queries for Mere Mortals http://www.viescas.com/ (Paris, France) For the inside scoop on Access 2007, see: http://blogs.msdn.com/access/
_____ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Squires, Neil Sent: Monday, June 19, 2006 5:53 PM To: [email protected] Subject: RE: [ms_access] CurDir help please This code will grab the database path and split it into the path and the filename. Neil Dim strFullPath As String strFullPath = Me.Application.CurrentDb.Name Dim strFilePath As String Dim strFileName As String Call parseFilePathAndName(strFullPath , strFilePath, strFileName) '---------------------------------------------------------- ' Routine Name : parseFilePathAndName ' Creation Date : 08/15/2005 09:44 ' Last Mod. Date : 08/15/2005 ' Routine Type : Sub ' In Parameters : ByVal strFullPath As String - The database name and path. ' Out Parameters : ByRef strDbPath As String - Database path only. ' ByRef strDbName As String - Database name only. ' IN/Out Params : ' Opt. Params : ' Return Type : ' Purpose : This routine takes a file path and breaks it into a path and a file name. '---------------------------------------------------------- Private Sub parseFilePathAndName(ByVal strFullPath As String, ByRef strDbPath As String, ByRef strDbName As String) If strFullPath = "" Or IsNull(strFullPath) Then Call errCustom("Invalid parameter condition, strFullPath, parseFilePathAndName()") Else ' All parameters are in good form. Continue with subroutine. ' Count Slashes Dim intCurPos As Integer Dim intTempPos As Integer Dim strSearchCharacter As String strSearchCharacter = "\" Do intCurPos = intTempPos If intTempPos = 0 Then ' Initial instance intTempPos = InStr(1, strFullPath, strSearchCharacter, 1) Else intTempPos = InStr(intCurPos + 1, strFullPath, strSearchCharacter, 1) End If ' If intTempPos = 0 Then Loop Until intTempPos = 0 ' intCurPos now contains the last location of the "\" key in the string. ' Trim the path out so only the db name remains. Dim strPath As String Dim strTempName As String strPath = Left(strFullPath, intCurPos) strTempName = Right(strFullPath, Len(strFullPath) - intCurPos) strDbPath = strPath strDbName = strTempName End If ' Parameter Checks End Sub . <http://geo.yahoo.com/serv?s=97359714&grpId=33071&grpspId=1600115370&msgId=2 0091&stime=1150732519> [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Great things are happening at Yahoo! Groups. See the new email design. http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/q7folB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/ms_access/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
