[AccessD] Get path from full file name

Heenan, Lambert Lambert.Heenan at AIG.com
Thu Oct 23 12:12:17 CDT 2003


Sigh... ;-(

<pedant mode>

\\fs1\sys\database\client1\somedb.mdb is a complete file "specification"
which is composed of the storage device (in this case a file server called
\\fs1), the *path* to the file and the file name.

</pedant mode>

That's what I meant by "Strictly speaking". I didn't write the definitions,
so please don't shoot the messenger. :-)

Of course I'm aware that using a fully qualified UNC file spec is accepted
by Access, I do it all the time myself. I just hate having to deal with
differently mapped drive letters of different user's systems.

I too would recommend an absolute file specification be used for most
purposes. With today's multi-tasking operating systems and multi threaded
applications the "current" folder can never be guaranteed to stay put.

InstrR() ???

Lambert


> -----Original Message-----
> From:	Gustav Brock [SMTP:gustav at cactus.dk]
> Sent:	Thursday, October 23, 2003 11:50 AM
> To:	Access Developers discussion and problem solving
> Subject:	Re: [AccessD] Get path from full file name
> 
> Hi Lambert
> 
> I may be wrong but to me
> 
>   \\fs1\sys\database\client1\somedb.mdb
> 
> is a valid full path and filename. Access thinks so too as you can
> open or link to a database using such a path/filename.
> 
> And if you wish to, say, export a file to the current dir of drive c:
> 
>   c:report.xls
> 
> is valid as a relative path/filename although I would recommend an
> absolute path/filename.
> 
> /gustav
> 
> 
> > 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
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


More information about the AccessD mailing list