Results 1 to 13 of 13
  1. #1
    Madmads is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    15

    Exclamation Is it possible to connect parts of image to cell values? Bind a picture to cells/table?

    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. Also cross posted here: https://www.access-programmers.co.uk...=1#post1562390. I also found this code, but its for Excel - I get an error using "Index" at the end wrong?

    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
    Last edited by Madmads; 01-16-2018 at 08:25 PM.

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Cross posted here: https://www.access-programmers.co.uk...=1#post1562390


    If you do cross-post, please state you have done so & provide the link
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    Madmads is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    15
    Off course. I am sorry.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Can have image on form. Then have controls on top of image. Could use Rectangle control set transparent, even the border transparent if you want. It has a click event.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Madmads is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    15
    Thank you so much. I am quite new to this. Do I need to store the pics seperataly? I will have around 15 pics - showing different kind of pain - in a folder (if not possible to import into Access). I am not familiar at coding this (the objects/language). Understand the logics - but could you give me a helping hand?

    Best. Mads

  6. #6
    Madmads is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    15

    Update: I will just embed some pics.

    I want a form that has the embedded pic of the human body on top. Then (I thought I could use radio buttons, behind/in front?). When I press them, I want the picture to change.

    For instance - this would be some cases:

    1) Pain in neck and down left arm (one picture)
    2) Pain just in neck (one picture)
    3) Pain in neck and shoulder (one picture).

    The best would off course be to have just one pic - and have Access point out areas for me ...

    Could really need some assistance .


    Here is some pics for testing purposes: I tried to do this with a combobox - selecting first "No pain" - first pic. Then "Pain in head" - second pick. But the best solution would off course having access to mark out the areas (with - for example radio buttons). Turning into some kind of different symbols when pressed?


    Click image for larger version. 

Name:	Pain man hode.jpg 
Views:	22 
Size:	147.8 KB 
ID:	32195Click image for larger version. 

Name:	Pain man.jpg 
Views:	22 
Size:	78.6 KB 
ID:	32196

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    There's certainly more than one way to approach this.

    Yes, images can be stored in table and in your case quite acceptable.

    Could have images overlaying the whole body image. Image control has Click event. Set the images as not visible and use code to set visibility when click the body.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    Madmads is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    15
    Thanks a lot. I think that would be a Perfect approach. Then I do not have to store a lot of external pics, but share the body into parts - duplicate the items. Like one "white" right shoulder and one on top - "red" - same size. When clicked, the red will be visiblre - and data should be entered into a corresponding Field and the tables needed should be updated. Right??

    My problem is that I do not know how to code this the best way (sorry for being a bit short, but in great pain)
    . Could you help me a bit on the way With a short example?

    Say I have "Head", "Neck right", "Neck left" - and I want them to be clicked at (multiple choises) and the values to be populated to Fields. Would also be Perfect to only populate relevant Fields, so that in the form, I do not see ALL the bodyparts which does not ache?

    An even more Perfect solution (as I understand the Logig) would to have the layers over - to be more and more opaque as the pain is going from 1-10. Meaning a slider (or a 1-10) Field, when parts are pressed showing up, prompting for the severness of the pain?

    Are you able to help me a bit? Thanks a lot. I just need some small example code With the syntax and the Objects. Thanks a lot again. And again.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    See attached file for a very simple demonstration. Discovered a rectangle control was not practical because have to click on its border, click in the middle area does not trigger click event. Therefore, resorted to a radio button next to body part.

    Body.zip

    Not aware of any way to manage varying opacity of images. That would require setting color values at the pixel level. Only alternative I can envision is managing visibility of multiple layered images. This would likely be quite complicated.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    Madmads is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    15
    Thank you so much. I think I have found another approach - I will attach the file, but I do not know the proper coding. I have tried Option Compare Database

    Private Sub Bilde2_Click()
    If Me.Bilde2.Visible = True Then Me.Bilde2.Visible = False
    Else
    Me.Bilde2.Visible = True
    End Sub

    But doesnt seem to work.

    Hopefully (if you got time) you could help me? Thanks a lot in advance. Kropp test.zipKropp test.zip

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    I thought of that method. However, a control that is not visible cannot be clicked. So how do you plan to make the image visible? Also, some images completely cover others.

    Hence the radio button.


    The posted code is not like what is in the db. Neither is proper syntax.

    Corrected posted code:
    Code:
    If Me.Bilde2.Visible = True Then 
          Me.Bilde2.Visible = False
    Else
          Me.Bilde2.Visible = True
    End Sub
    In the db, remove the two End If lines to eliminate the Compile error.


    However, as already pointed out above, neither will accomplish your goal.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    Madmads is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    15
    Maybe I have to insert two images for one instance - one that is not red, one that is red. When clicked, the form changes to show either the "white" (no pain) or the "red" (pain)? So then I still have clickable areas? But for now, I think i Will need radio buttons. As there are a lot of images to be shown/hidden, is there a code that could save me some time, when stacking all the images layer by layer, so I do not need to write a event for each of them? Best, and thanks. Mads.

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    I mentioned earlier stacked images would be complicated code.

    Each image would require its own event code, even if that code is to call another procedure that does the work of setting visibility of controls.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 07-07-2015, 08:12 PM
  2. Merging Data from 3 Cells to One Cell
    By Upon66 in forum Queries
    Replies: 5
    Last Post: 08-11-2012, 11:04 AM
  3. Replies: 3
    Last Post: 08-02-2012, 11:37 AM
  4. picture image link on a table textbox
    By john_gringo in forum Access
    Replies: 5
    Last Post: 11-04-2011, 02:21 PM
  5. Replies: 7
    Last Post: 09-15-2011, 01:58 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums