UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Displaying a Photograph within a form    
 
   
dcartwright
post Jul 31 2006, 05:40 AM
Post #1

New Member
Posts: 2



Hi There

I am relatively new to Access, but wonder if someone can give me some hints with a problem that I am having.

I have a number of photographs stored on a network drive and i want to be able to link a photo to a record in my database.

I have tried using the hyperlink and that works in so far as I can click on the field in the form and it opens up my picture.

I have also tried creating the field as a OLE object and linking it to the photos. Again this works in so far as when i look at the form I can see a box with the file name in and when i click on the box It opens a package and displays the photograph.

But what I actually want is to display the photo directly in the form as I move from record to record the picture to automatically change. I understand that I can embed the pictures in the database but this makes the database very big. So this is not an option for me.

I hope I am clear in explaining what I need. Can someone please tell me if this is feasible and if so what I need to do.

just so you are aware, I have very very limited knowledge with SQL if that is a direction you were going to point me in.

Many thanks

Dave
Go to the top of the page
 
+
kuifjexx
post Jul 31 2006, 06:18 AM
Post #2

UtterAccess VIP
Posts: 7,232
From: Belgium



Welcome to UA

See this => MS Access Downloads
Look on that page for 'Picture in Database'

HTH

Greetz from Belgium (IMG:http://www.utteraccess.com/forum/style_emoticons/default/compute.gif)

Luc aka Kuifjexx
Go to the top of the page
 
+
dcartwright
post Jul 31 2006, 06:28 AM
Post #3

New Member
Posts: 2



Many Thanks for that kuifjexx, it looks to do exactly as I need. I will apply this to my database.

Regards

Dave
Go to the top of the page
 
+
freakazeud
post Jul 31 2006, 06:29 AM
Post #4

UtterAccess VIP
Posts: 31,413
From: NC, USA



Hi,
welcome to UA forums.
You should not try to embed images in your database. This will bloat the file size to outrageous amounts. Instead just add a text datatype field to your table and only store the path to the external file. You can then use the path at runtime on forms/reports to display them.
A good tutorial of this can be found here or at candace's utterangel.com.
HTH
Good luck
Go to the top of the page
 
+
kuifjexx
post Jul 31 2006, 07:46 AM
Post #5

UtterAccess VIP
Posts: 7,232
From: Belgium



Glad I could help you (IMG:http://www.utteraccess.com/forum/style_emoticons/default/wink.gif)

So as you see embedding the picture is not the most appropiate /adviceable way to store pictures in a database ...

Good luck

Greetz from Belgium (IMG:http://www.utteraccess.com/forum/style_emoticons/default/compute.gif)

Luc aka Kuifjexx
Go to the top of the page
 
+
JodyMac12
post Aug 16 2006, 12:55 PM
Post #6

UtterAccess Member
Posts: 45
From: central Kentucky



Hello -

I recently was able to set up a form to include photos as described at www.databasedev.co.uk/bound_image_form.html. (see below).

Option Compare Database

Private Sub Form_Current()

On Error Resume Next

Me![ImageFrame].Picture = Me![ImagePath]

End Sub

Private Sub ImagePath_AfterUpdate()

On Error Resume Next

Me![ImageFrame].Picture = Me![ImagePath]

End Sub

this was a big accomplishment for me, i'm not much at using ms visual basic...

i still have a relatively minor problem, though. not all of my clients have photos attached to their files. when i switch from a client that does have a photo to one that does not, the photo from the previous client shows up. i'd like to set it up so that if a client does not have a photo, something shows up to indicate 'no photo', or something like that...any easy way to do that? thanks iin advance for looking at this...Jody McClain
Go to the top of the page
 
+
freakazeud
post Aug 16 2006, 01:00 PM
Post #7

UtterAccess VIP
Posts: 31,413
From: NC, USA



Hi,
Welcome to UA forums.
I think the best method to achieve that would be to create a default image which you display if no value is present. You can then alter your code to something like this:

If Len(Me!ImagePath & vbNullString) = 0 Then
Me![ImageFrame].Picture = "c:\path to default image\default.bmp"
Else
Me![ImageFrame].Picture = Me![ImagePath]
End If

Another option would be to clear out the image frame and display a hidden label e.g.:

If Len(Me!ImagePath & vbNullString) = 0 Then
Me![ImageFrame].Picture = ""
Me!YourLable.Visible = True
Me!YourLabel.Caption = "No Photo here"
Else
Me![ImageFrame].Picture = Me![ImagePath]
Me!YourLable.Visible = False
End If

HTH
Good luck
Go to the top of the page
 
+
JodyMac12
post Aug 16 2006, 02:38 PM
Post #8

UtterAccess Member
Posts: 45
From: central Kentucky



Thank you - it works great, and the size reduction of the database is amazing!
Go to the top of the page
 
+
freakazeud
post Aug 16 2006, 02:42 PM
Post #9

UtterAccess VIP
Posts: 31,413
From: NC, USA



You're welcome.
Good luck on future projects!
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 03:22 PM