469,619 Members | 2,200 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,619 developers. It's quick & easy.

Help please! Linking, showing, but not embedding images

Hello all.

I hope someone can help me here. I need to make a db on many pictures,
however, if I OLE them, the access database grows hugely. If I only
hyperlink them, I can't view them. is there a way how I can hyperlink
the pictures and have something like thumbnails to view them in a form?
any comment apprecciated. thanks

Nov 13 '05 #1
6 1751
Use an Image control to view the picture and store a Text item in the table
called E.G "PhotoPath" which is the path to the picture
something like "C:\My Documents\MyPhotos\Photo1.jpg"

You then need a bit of code on the OnCurrent event of the form like
Me!Photo.Picture = Me!PhotoPath

You will need to do check whether the photo exists
If Dir(PhotoPath) = "" Then ' not found
....
End if

You may also get annoyed with a message box temporarily appearing saying
something about JPEG Image loading

Have a look at the registry (Windows XP) and find
HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics
Filters\Import\JPEG\Options Yes
Change the Yes to a No to stop this.

There are routines to do this automatically on opening the form

HTH

Phil

<th***********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hello all.

I hope someone can help me here. I need to make a db on many pictures,
however, if I OLE them, the access database grows hugely. If I only
hyperlink them, I can't view them. is there a way how I can hyperlink
the pictures and have something like thumbnails to view them in a form?
any comment apprecciated. thanks

Nov 13 '05 #2
Use an ImageFrame on the form, store images in a folder, and use the
following code:

Private Sub Form_Current()

' Display the picture for the current employee record if the image
' exists. If the file name no longer exists or the file name was blank
' for the current employee, set the errormsg label caption to the
' appropriate message.

Dim res As Boolean
Dim fName As String

Path = CurrentProject.Path & "\Employee Photos"
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" & vbCrLf & " insert
Employee's photo"
errormsg.Visible = True
End If

Me.lblDisplayLastName.Caption = Me.LastName
Me.lblDisplayFirstName.Caption = Me.FirstName
End Sub
--

Tony D'Ambra
Web Site: aadconsulting.com
Web Blog: accessextra.net

<th***********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hello all.

I hope someone can help me here. I need to make a db on many pictures,
however, if I OLE them, the access database grows hugely. If I only
hyperlink them, I can't view them. is there a way how I can hyperlink
the pictures and have something like thumbnails to view them in a form?
any comment apprecciated. thanks

Nov 13 '05 #3
hey, thanks

I tried it. unfortunately, I get the message that the OnCurrent
procedure produced an 'invalid outside procedure' - what am I doing
wrong? my VB isn't very good, sorry. also I'm using access 97.

Theo

Nov 13 '05 #4
hello,
thanks for the code. however, access complains about

"CurrentProject" highlighted - 'variable not defined'

any ideas? I am sorry, I am not very good with VB, also my version of
access is '97.
thanks a lot.
Theo

Nov 13 '05 #5
Try this

Function FindOldPhoto(frm As Form, PhotoPath As String, ID As Long)

'HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics
Filters\Import\JPEG\Options ShowProgressDialog No

Dim Msg As String, FilterName As String

If Nz(ID) = 0 Or Nz(PhotoPath) = "" Then
frm!Photo.Picture = ""
Exit Function
End If

If Dir(PhotoPath) = "" Then ' not found
Msg = "Photo: " & PhotoPath & vbCrLf
Msg = Msg & "is not found at the above location (or is misspelled)"
MsgBox Msg, vbInformation, "Missing Photo"
frm.Photo.Picture = ""
Exit Function
End If

frm!Photo.Picture = frm!PhotoPath

End Function

Private Sub Form_Current()

Call FindOldPhoto(Me, Nz(PhotoPath), ID) ' Load Photo

End Sub

When you say your VB is not too good, does that mean you have some or no
experience with Events.

Phil

<th***********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
hello,
thanks for the code. however, access complains about

"CurrentProject" highlighted - 'variable not defined'

any ideas? I am sorry, I am not very good with VB, also my version of
access is '97.
thanks a lot.
Theo

Nov 13 '05 #6
hello-
sorry, been away. I've had some experience with VB, a little with
events, but that was years ago at school. however, I've found another
solution which I should've looked into before anyway, and downloaded a
program called picasa, which I found is quite sufficient (and which I
can highly recommend!). sorry to have bothered you all.
happy new year and a belated merry xmas!
Theo

Nov 13 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by duikboot | last post: by
23 posts views Thread by Jason | last post: by
8 posts views Thread by Roger Chapman | last post: by
nomad
reply views Thread by nomad | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.