GetOpenFile() and UNC path

  • Thread starter Thread starter Nick Del Vecchio
  • Start date Start date
N

Nick Del Vecchio

I'm using the Me.textpic = GetOpenFile() code to search for a picture
in order to put the picture path on a form's text box.

This works fine except that I would like for it to display the UNC
path rather than the drive and directory path. Even if I browse to
the server share and pick the file using My Network places, it still
displays the drive and directory path instead of the UNC path.

Anyone know how I can get the GetOpenFile() to display the UNC path?

Thanks
 
Nick Del Vecchio said:
I'm using the Me.textpic = GetOpenFile() code to search for a picture
in order to put the picture path on a form's text box.

This works fine except that I would like for it to display the UNC
path rather than the drive and directory path. Even if I browse to
the server share and pick the file using My Network places, it still
displays the drive and directory path instead of the UNC path.

Anyone know how I can get the GetOpenFile() to display the UNC path?


There's a Windows API call to convert a mapped-drive path to a UNC path, but
I'm very surprised that you aren't getting the UNC path directly from
GetOpenFile if you browse to the network share rather than the mapped drive.
My own experience and everything I've ever seen posted says that you ought
to get the UNC path if you browse that way. What version of Windows and
Access are you using, and where did you get the GetOpenFile code you're
using?
 
Dirk,

I have the database on a computer with Windows XP SP3 using Access
2002. The database and image files are in that computer's local
folder which has been shared on the network.
When I browse to the image from that computer using My Network places,
Access changes the path to the local folder after I select the photo.
However, if I launch the same database from a networked computer that
uses Windows XP and Access 2003, the text box keeps the UNC path after
I select the photo.

If I use the local computer to access the same file with the UNC path
to the picture that was created by a networked computer - there is no
problem. The picture is displayed. This works well for all networked
computers as well.

However, if I use a networked computer to view the picture that was
inserted by the local computer, the path is to that computer's local
drive and I get an error that states that the path is not valid. For
some reason, the local computer with Access 2002 is changing the path
to it's local drive instead of maintaining the UNC path.

The code is very old. This is in the header of the basFileOpenDialog
module

'***************** Code Start **************
'This code was originally written by Ken Getz.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
' Code courtesy of:
' Microsoft Access 95 How-To
' Ken Getz and Paul Litwin
' Waite Group Press, 1996
 
Nick Del Vecchio said:
I have the database on a computer with Windows XP SP3 using Access 2002.
The database and image files are in that computer's local folder which has
been shared on the network. When I browse to the image from that computer
using My Network places, Access changes the path to the local folder after
I select the photo. However, if I launch the same database from a
networked computer that
uses Windows XP and Access 2003, the text box keeps the UNC path after I
select the photo.
If I use the local computer to access the same file with the UNC path to
the picture that was created by a networked computer - there is no
problem. The picture is displayed. This works well for all networked
computers as well.

However, if I use a networked computer to view the picture that was
inserted by the local computer, the path is to that computer's local drive
and I get an error that states that the path is not valid. For some
reason, the local computer with Access 2002 is changing the path to it's
local drive instead of maintaining the UNC path.

I can't seem to reproduce that on my PC running Vista, but I may not have
set up the exact same circumstances. I don't think it's Ken Getz's code, as
I'm using that code myself. I suspect it's an OS thing. I don't have any
good suggestion, though, except to either type in the UNC path directly (if
that works), or do it on a networked PC instead of the one where the file is
local.
 
Back
Top