Is it possible to connect parts of image to cell values? Bind a picture to cells/tabl (1 Viewer)

MadMads

New member
Local time
Today, 03:51
Joined
Jan 17, 2018
Messages
6
Hi. Thanx for letting me into this forum. I have neck prolapse and want to make a "pain diary". I would love to have the ability to have an image of a silhouette body. Then - I can pick different Places on the body by the mouse - and by that - adding values to a table cell. Say, for instance; I have severe pain in my neck one day. At the same time I can feel radiation out to my arm. Is it possible to embed a Picture of a human, splitting the part of the "image" into parts that can be written to a table if selected? Hope for a quick answer as this pain is killing me. Thanks a lot. Best.
 

plog

Banishment Pending
Local time
Yesterday, 20:51
Joined
May 11, 2011
Messages
11,638
Yes, sort of. A button can display an image, so if you cut up an image into rectangles you could then reconstruct the image via buttons. Add an onclick event to the buttons to add data to the database.

To get more grainular, I believe you can capture the x\y position on the mouse via VBA. That would allow you to use an actual image object and define body areas non-rectangularly and down to the pixel level.
 

MadMads

New member
Local time
Today, 03:51
Joined
Jan 17, 2018
Messages
6
Thanx. I am quite New to this - could you help me a bit on the coding? I found this for Excel, but does not seem to work for Access?

Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
Dim fA()
Dim i%, n%
Dim dName$
ChDrive "c"
ChDir "C:\Photographs\Zelda"
dName = Dir("*.jpg")
Do While dName <> ""
n = n + 1
ReDim Preserve fA(1 To n)
fA(n) = dName
dName = Dir()
Loop
For i = 1 To n
ComboBox1.AddItem fA(i)
Next
ComboBox1.ListIndex = 0
Application.ScreenUpdating = True
End Sub

Sub ComboBox1_Change()
Image1.Picture = LoadPicture(ComboBox1.Value)
End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:51
Joined
May 7, 2009
Messages
19,229
On your LoadPicture func, add the path:

Image1.Picture = LoadPicture("c:\photographs\zelda" & ComboBox1.Value)
 

MadMads

New member
Local time
Today, 03:51
Joined
Jan 17, 2018
Messages
6
But isnt this syntax for Excel? Works there - but not in Access? The path is not correct, as it is in my downloads - or do I need to add the path? I also get index errors?

Would be so Grateful for someone who could help me "tranlsate" this syntax to Access VBA. :confused:
 

MadMads

New member
Local time
Today, 03:51
Joined
Jan 17, 2018
Messages
6
On your LoadPicture func, add the path:

Image1.Picture = LoadPicture("c:\photographs\zelda" & ComboBox1.Value)
My mistake - I have just pasted the code I found on the interenet. I have changed the paths - but not in the functions. I am also not sure about where to put the codes - and if "Form_initalize" is a proper syntax? Best Mads
 

Cronk

Registered User.
Local time
Today, 11:51
Joined
Jul 4, 2013
Messages
2,771
Access forms do not have an Initialize event

Use the form Load event
 

MadMads

New member
Local time
Today, 03:51
Joined
Jan 17, 2018
Messages
6
But where should I put it? I am almost there - I got a Runtime error 2220 "Microsoft cannot open the file" and the name. But I was able to put it into a frame from start?

Best Mads
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:51
Joined
May 7, 2009
Messages
19,229
If thus is access, you can simply do this:

Image1.Picture = "c:\photographs\zelda\" & ComboBox1.Value
 

Users who are viewing this thread

Top Bottom