Open a image matching a field

fibonacci

Registered User.
Local time
Today, 20:20
Joined
May 5, 2015
Messages
13
Hi evryone,
I have to create a database with more than ten thousand records. There is a field on which image by clicking the image to be displayed with the default program based on the image on which you clicked. Whit this code:


Code:
 Private Sub Campo1_Click()
     
     Dim L As Long 
     L = ShellExecute(0, "Open", """" & "C:\Users\Nick\Desktop\Documenti\Pictures\DioDiego.jpg" & """", vbNullString, vbNullString, 1)
 [FONT=Calibri]End Sub[/FONT]
 [FONT=Calibri][SIZE=3] [/SIZE][/FONT]

when onClick event happens on the image is displayed the same image regardless of the record on which you clicked. How do I change the code to open the image of the field that was clicked? (I'm a beginner of VBA)
 
it is the same image because that is what you code is requesting - DioDiego.jpg

suggest you probably need

"C:\Users\Nick\Desktop\Documenti\Pictures\" & me.Campo1
 
it is the same image because that is what you code is requesting - DioDiego.jpg

suggest you probably need

"C:\Users\Nick\Desktop\Documenti\Pictures\" & me.Campo1
Thanks, I solved with Me.Campo1.FileName If I remember right
 

Users who are viewing this thread

Back
Top Bottom