Show full path from form to table

G

Guest

I have a form that has a button to add a path to a photo. (see below
code(code borrowed from Northwind db))

It works great but I need it to store the complete path...
It stores -
I:\Monthly Project Updates\Project Reporting\Bell_Bonanza_Page_2.tif

I need full path-
\\serv7\w720\Dept\Service-Projects\Monthly Project Updates\Project
Reporting\\Bell_Bonanza_Page_2.tif

Dim res As Boolean
Dim fName As String

Path = CurrentProject.Path
On Error Resume Next
errormsg.Visible = False
If Not IsNull(Me!Photo) Then
res = IsRelative(Me!Photo)
fName = Me![ImagePath]
If (res = True) Then
fName = Path & "\" & fName
End If

Me![ImageFrame].Picture = fName
showImageFrame
Me.PaintPalette = Me![ImageFrame].ObjectPalette
If (Me![ImageFrame].Picture <> fName) Then
hideImageFrame
errormsg.Caption = "Picture not found"
errormsg.Visible = True
End If
Else
hideImageFrame
errormsg.Caption = "Click Add/Change to add picture"
errormsg.Visible = True
End If
 
D

Damon Heron

If its always the same path, then add this to your code:

If (res = True) Then
fName = Path & "\" & fName
fName = Replace(fName, "I:",
"\\serv7\w720\Dept\Service-Projects", , 1, 1)

End If


HTH
Damon
 
G

Guest

Thank you for your help,
Unfortunately, the path is sometimes different.

I need the whole UNC path.

Does anyone have any idea how to make this happen.

Thanks in advance
--
deb


Damon Heron said:
If its always the same path, then add this to your code:

If (res = True) Then
fName = Path & "\" & fName
fName = Replace(fName, "I:",
"\\serv7\w720\Dept\Service-Projects", , 1, 1)

End If


HTH
Damon

deb said:
I have a form that has a button to add a path to a photo. (see below
code(code borrowed from Northwind db))

It works great but I need it to store the complete path...
It stores -
I:\Monthly Project Updates\Project Reporting\Bell_Bonanza_Page_2.tif

I need full path-
\\serv7\w720\Dept\Service-Projects\Monthly Project Updates\Project
Reporting\\Bell_Bonanza_Page_2.tif

Dim res As Boolean
Dim fName As String

Path = CurrentProject.Path
On Error Resume Next
errormsg.Visible = False
If Not IsNull(Me!Photo) Then
res = IsRelative(Me!Photo)
fName = Me![ImagePath]
If (res = True) Then
fName = Path & "\" & fName
End If

Me![ImageFrame].Picture = fName
showImageFrame
Me.PaintPalette = Me![ImageFrame].ObjectPalette
If (Me![ImageFrame].Picture <> fName) Then
hideImageFrame
errormsg.Caption = "Picture not found"
errormsg.Visible = True
End If
Else
hideImageFrame
errormsg.Caption = "Click Add/Change to add picture"
errormsg.Visible = True
End If
 
D

Douglas J. Steele

The code in http://www.mvps.org/access/api/api0003.htm at "The Access Web"
will translate from mapped drive letters to UNCs.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


deb said:
Thank you for your help,
Unfortunately, the path is sometimes different.

I need the whole UNC path.

Does anyone have any idea how to make this happen.

Thanks in advance
--
deb


Damon Heron said:
If its always the same path, then add this to your code:

If (res = True) Then
fName = Path & "\" & fName
fName = Replace(fName, "I:",
"\\serv7\w720\Dept\Service-Projects", , 1, 1)

End If


HTH
Damon

deb said:
I have a form that has a button to add a path to a photo. (see below
code(code borrowed from Northwind db))

It works great but I need it to store the complete path...
It stores -
I:\Monthly Project Updates\Project Reporting\Bell_Bonanza_Page_2.tif

I need full path-
\\serv7\w720\Dept\Service-Projects\Monthly Project Updates\Project
Reporting\\Bell_Bonanza_Page_2.tif

Dim res As Boolean
Dim fName As String

Path = CurrentProject.Path
On Error Resume Next
errormsg.Visible = False
If Not IsNull(Me!Photo) Then
res = IsRelative(Me!Photo)
fName = Me![ImagePath]
If (res = True) Then
fName = Path & "\" & fName
End If

Me![ImageFrame].Picture = fName
showImageFrame
Me.PaintPalette = Me![ImageFrame].ObjectPalette
If (Me![ImageFrame].Picture <> fName) Then
hideImageFrame
errormsg.Caption = "Picture not found"
errormsg.Visible = True
End If
Else
hideImageFrame
errormsg.Caption = "Click Add/Change to add picture"
errormsg.Visible = True
End If
 
G

Guest

Thank you for your resopnse.

I checked the link and it looks like it will give me a list of all paths in
my network computer. wow

I am not savy enough to take this and make it do what I need it to do.

I used the employees form of the Northwind database that allows the click of
a button to find and store the path of an image. it returns the relative
path which included the drive letter...

I need the whole path that includes the server instead of the drive letter.
I do not know how to take what you send and incorporate it into the code in
my origional post. When someone else used my bd on the server it cannot find
the image because it is trying to search for the I: That is why I need the
complete path.
Can you help?

I wish there was somewhere I could learn VBA. I am not very good at the
code, but I try and try...
--
deb


Douglas J. Steele said:
The code in http://www.mvps.org/access/api/api0003.htm at "The Access Web"
will translate from mapped drive letters to UNCs.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


deb said:
Thank you for your help,
Unfortunately, the path is sometimes different.

I need the whole UNC path.

Does anyone have any idea how to make this happen.

Thanks in advance
--
deb


Damon Heron said:
If its always the same path, then add this to your code:

If (res = True) Then
fName = Path & "\" & fName
fName = Replace(fName, "I:",
"\\serv7\w720\Dept\Service-Projects", , 1, 1)

End If


HTH
Damon

I have a form that has a button to add a path to a photo. (see below
code(code borrowed from Northwind db))

It works great but I need it to store the complete path...
It stores -
I:\Monthly Project Updates\Project Reporting\Bell_Bonanza_Page_2.tif

I need full path-
\\serv7\w720\Dept\Service-Projects\Monthly Project Updates\Project
Reporting\\Bell_Bonanza_Page_2.tif

Dim res As Boolean
Dim fName As String

Path = CurrentProject.Path
On Error Resume Next
errormsg.Visible = False
If Not IsNull(Me!Photo) Then
res = IsRelative(Me!Photo)
fName = Me![ImagePath]
If (res = True) Then
fName = Path & "\" & fName
End If

Me![ImageFrame].Picture = fName
showImageFrame
Me.PaintPalette = Me![ImageFrame].ObjectPalette
If (Me![ImageFrame].Picture <> fName) Then
hideImageFrame
errormsg.Caption = "Picture not found"
errormsg.Visible = True
End If
Else
hideImageFrame
errormsg.Caption = "Click Add/Change to add picture"
errormsg.Visible = True
End If
 
D

Douglas J. Steele

Copy everything between Code Start and Code End on that page to a new module
(not a class module). Change the line of code

Private Function fGetUNCPath(strDriveLetter As String) As String

to

Public Function fGetUNCPath(strDriveLetter As String) As String

When you save the module, make sure that the name of the module isn't the
same as any of the routines inside the module.

Go to the Immediate Window (Ctrl-G), type ?fGetUNCPath("I:") and hit Enter.
Assuming your I: drive is mapped, you'll see the UNC underneath.

So, what this means is when you've got a mapped drive (i.e. when position 2
of the path is a colon), you can strip off the first 2 characters (which
will be the drive letter and colon), pass it to the function and then
concatenate that with the rest of the path:

fGetUNCPath(Left$(strFullPath, 2)) & Mid$(strFullPath, 3)

Now, you'll likely want some error checking (such as making sure that
position 3 is a slash and so on), but hopefully that's enough to get you
going.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


deb said:
Thank you for your resopnse.

I checked the link and it looks like it will give me a list of all paths
in
my network computer. wow

I am not savy enough to take this and make it do what I need it to do.

I used the employees form of the Northwind database that allows the click
of
a button to find and store the path of an image. it returns the relative
path which included the drive letter...

I need the whole path that includes the server instead of the drive
letter.
I do not know how to take what you send and incorporate it into the code
in
my origional post. When someone else used my bd on the server it cannot
find
the image because it is trying to search for the I: That is why I need the
complete path.
Can you help?

I wish there was somewhere I could learn VBA. I am not very good at the
code, but I try and try...
--
deb


Douglas J. Steele said:
The code in http://www.mvps.org/access/api/api0003.htm at "The Access
Web"
will translate from mapped drive letters to UNCs.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


deb said:
Thank you for your help,
Unfortunately, the path is sometimes different.

I need the whole UNC path.

Does anyone have any idea how to make this happen.

Thanks in advance
--
deb


:

If its always the same path, then add this to your code:

If (res = True) Then
fName = Path & "\" & fName
fName = Replace(fName, "I:",
"\\serv7\w720\Dept\Service-Projects", , 1, 1)

End If


HTH
Damon

I have a form that has a button to add a path to a photo. (see below
code(code borrowed from Northwind db))

It works great but I need it to store the complete path...
It stores -
I:\Monthly Project Updates\Project Reporting\Bell_Bonanza_Page_2.tif

I need full path-
\\serv7\w720\Dept\Service-Projects\Monthly Project Updates\Project
Reporting\\Bell_Bonanza_Page_2.tif

Dim res As Boolean
Dim fName As String

Path = CurrentProject.Path
On Error Resume Next
errormsg.Visible = False
If Not IsNull(Me!Photo) Then
res = IsRelative(Me!Photo)
fName = Me![ImagePath]
If (res = True) Then
fName = Path & "\" & fName
End If

Me![ImageFrame].Picture = fName
showImageFrame
Me.PaintPalette = Me![ImageFrame].ObjectPalette
If (Me![ImageFrame].Picture <> fName) Then
hideImageFrame
errormsg.Caption = "Picture not found"
errormsg.Visible = True
End If
Else
hideImageFrame
errormsg.Caption = "Click Add/Change to add picture"
errormsg.Visible = True
End If
 

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