Records and Images

gusgaff

Registered User.
Local time
Today, 06:29
Joined
Sep 1, 2013
Messages
12
Hi all,
I previously posted in the General forum but got no reply.
(Problem) I have several text boxes which I can populate using the DLookup.
I have images I want to display for individual records.
I use a search (textbox) to input client name and this populates all other textboxes. I am trying to get the relevant image to display also using this search box. I have also disabled record selectors just tidy up the form. I have tried coding the image control on the AfterUpdate event of the search box. This is doing my nut in. Full path to images are stored as JPG in my ClientTable not as OLE. Can anyone help?
 
Code to populate all textboxes.

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] & "'")
End Sub

Code to load client photo into form when client record is displayed in textboxes. I have tried the oncurent event of the form, I am still trying to learn and understand VBA sorry if I sound a bit stupid at times.

Cheers

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
 

Users who are viewing this thread

Back
Top Bottom