Question Images and Records

gusgaff

Registered User.
Local time
Today, 16:43
Joined
Sep 1, 2013
Messages
12
I have a database with client details and photos.
i have a textbox as an input box and seperate search button.
I can populate all my textboxes on my form with all client details using DLookup., but i can only get the first record to show the corresponding image to that one client. How can i get the image to show for each client when i enter their name in my input box and show their photo.

Thank you.
 
What version of Access and is this a continuous Form?
 
Access 2010, Single form.
 
Show you code for loading the photo.
 
So sorry... seems I missed the eMail follow-up that you had posted a reply. Hope I'm not too late. In any event here you go...

You really don't want to store pictures in the database, it will cause bloating which will push your database to it's max size (2 gig) very quickly. Try this link which has MANY samples of how to insert/display images in forms and reports.
http://www.granite.ab.ca/access/imagehandling.htm

P.S. If you already have code that is not working, then please post.
 

Code to display client photo with corresponding client record.
I'm using JPG images stored in the same directory as DB not using OLE.
Private Sub Form_Load()
Me.InsideHeight = 4500
Me.InsideWidth = 9000


If clientname.Value = "" Then
Image28.Visible = False

ElseIf clientname.Value = ("[ID]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'") Then
Image28.Visible = True
End If
End Sub
 
Hmm, okay I don't see the code that links the Image on your hard drive to the Image Control. I'm also going to suggest you move this...

Code:
If clientname.Value = "" Then
  Image28.Visible = False
 
ElseIf clientname.Value = ("[ID]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'") Then
  Image28.Visible = True
End If

...to the On_Current event. Since the Form only Loads once it makes sense that only the first Image would Load. Note, if you are using a Combo Box to look-up ID's AND the above does not work in the On_Current event then put the above in the After_Update event of the Combo Box.
 
Hi,
The full path is in a field on the table Clientdetails.
Al the photos show correctly when I use navigation buttons. I have disabled navigation and selector bar. I use a search button called (clientname)to input the clients name which in turn will show that clients picture. E:\ is a portable Hard Drive.

Path:
E:\Kandu\Kandu Database\Clientphoto.jpg

Cheers.
 
Not sure I understand your reply... Are you saying you moved the code and tried it?
 
Code to display client photo with corresponding client record.
I'm using JPG images stored in the same directory as DB not using OLE.
Private Sub Form_Load()
Me.InsideHeight = 4500
Me.InsideWidth = 9000


If clientname.Value = "" Then
Image28.Visible = False

ElseIf clientname.Value = ("[ID]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'") Then
Image28.Visible = True
End If
End Sub
What method do you use to read the picture/picturedata for the current client into the Image28, (I suppose Image28 is the control for the photo)?
Else post your database with some sample data - I don't need any picture/photo I can use some other I've. Plus information about the form name.
 
I have tried it previously in the oncurrent event Gina.
I've tried practising with different forms so i'm probably just totally confusing myself.

This is the DLookup for the table Clientdetails in which I have stored the path to each photo, in a field called ClientPhoto, I thought if I follow the same sort of principle that would allow me to insert the photo into the image frame called Image28
Private Sub clientname_AfterUpdate()
ID = DLookup("[ID]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Forename = DLookup("[Forename]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Surname = DLookup("[Surname]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Address1 = DLookup("[Address1]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Address2 = DLookup("[Address2]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Address3 = DLookup("[Address3]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Phonenumber = DLookup("[Phonenumber]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
attending = DLookup("[Daysattending]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
 
You need to point to the image path like...

Me.Image28.Picture = Your DLOOKUP path here...

If ID field is numeric...
=DLookup("FieldFromTableOrQuery", "YourTableOrQuery", "[FieldFromTableOrQuery]=" & Me![FieldFromForm])

If ID field is text…
=DLookup("FieldFromTableOrQuery", "YourTable", "[FieldFromTableOrQuery]='" & Me![FieldFromForm] & "'")

In order for the image to display.
 

Users who are viewing this thread

Back
Top Bottom