Full File Path

M

Martin

I am trying to write some code that tells me the server name and file
extension of the current database. The code is as follows:


Dim CurrentFileName As String
CurrentFileName = Application.CurrentDb.Name
MsgBox CurrentFileName


If the file is located on my T drive for instance then this code shows me
T:\....

I need it to show me the actual server name. Is there a way of formatting
the response or do I need different code?

Thanks,

Martin
 
W

Wayne Morgan

First, I wouldn't use network drive letters. I would use the UNC path to
start with, that way you don't have to worry about the drive letter that has
been mapped.

To get the UNC path from a network drive, you can use an API call. For an
example, see this link.

http://www.mvps.org/access/api/api0003.htm
 
M

Martin

Thanks Wayne. This is excellent. What a great website too. I've just
started programming in Access and this will very helpful.

Thanks again,

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top