Heenan, Lambert
Lambert.Heenan at AIG.com
Thu Oct 23 08:50:22 CDT 2003
Hello Gustav, "You didn't run any test on it, did you?" - that's a pretty big assumption isn't it? I did run test and got the same results as you did, with those two exceptions, which I managed to overlook. <g> <pedant mode> Strictly speaking, the drive letter and the server name are not part of the file path in any case. The path is the route of folders that must be traversed to reach the file on the storage device, </pedant mode> but if you want to emulate the results of your routine, here's a simple modification of mine... Function GetPath(aPath) As String ' Strips the path name from the supplied file and path name ' leaves the trailing slash on there Dim foo As Integer, aSlash As Integer aSlash = 0 foo = InStr(aPath, "\") While (foo > 0) aSlash = foo foo = InStr(aSlash + 1, aPath, "\") Wend If aSlash > 0 Then If aSlash = 2 Then GetPath = aPath Else GetPath = Left$(aPath, aSlash) End If Else If (Left(UCase(aPath), 1) >= "A" And Left(UCase(aPath), 1) <= "Z") _ And Mid(aPath, 2, 1) = ":" Then GetPath = Left(aPath, 2) Else GetPath = aPath End If End If End Function BTW, did you check out the InstrR() function for A97? Lambert > -----Original Message----- > From: Gustav Brock [SMTP:gustav at cactus.dk] > Sent: Thursday, October 23, 2003 3:25 AM > To: Heenan, Lambert > Subject: [AccessD] Get path from full file name > > Hi Lambert > > You didn't run any test on it, did you? > > It is similar to the quickies found many places and it fails for paths > like "\\fs1" and "c:file". > > /gustav > > > > Well here is my little GetPath routine which does not use InstrRev > either, > > but seems a lot simpler than yours. It also returns the same results as > your > > function ...