Results 1 to 12 of 12
  1. #1
    Ziploc is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    6

    Question Using a background image as mask

    Hi all,

    I'm not sure if my title is clear enough but I would like some help with making an Access form that uses an image as background that allows me to choose any area of the image and add a comment.
    For example I want to use a map....pinpoint any specific area and input some data there....

    Is it possible to do in Access and how ?

    Thx in advance for advice and help

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    You don't input data to an image, data goes into a table. There is no data in an image that Access can understand. Code can capture the x and y coordinates of where the mouse clicks but of what use is that to you?
    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.

  3. #3
    Ziploc is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    6
    Quote Originally Posted by June7 View Post
    You don't input data to an image, data goes into a table. There is no data in an image that Access can understand. Code can capture the x and y coordinates of where the mouse clicks but of what use is that to you?
    I know...I just want to use a mask to ''locate'' the data...the coordinates would be the means to achieve that....but is there a easy way to achieve that ?

    it's for a medical purpose

    I want to use a human body outline as a background, and be able, by clicking on a body part or region create a note that will be input to a table...
    let say to locate a wound or scar, etc.

    if that's clear enough...

    it would be a kind of dynamic form....with hidden fields uncovered only when clicked on.....

    but it must be kind precise and not too limiting in the same time...
    quite a challenge i guess...

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Yes, what you want is not easy.

    Better off picking body part from a combobox list.

    Hidden fields (actually, on a form these would be controls such as textbox or combobox) cannot be 'clicked on' and revealed.
    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
    Ziploc is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    6
    Quote Originally Posted by June7 View Post
    Yes, what you want is not easy.

    Better off picking body part from a combobox list.

    Hidden fields (actually, on a form these would be controls such as textbox or combobox) cannot be 'clicked on' and revealed.
    That's what I was afraid of.....I guess Access is too limited for that...

  6. #6
    Rivanni is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    9
    Use the mouse down event to capture the X and Y coordinates. Not that difficult.

  7. #7
    Ziploc is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    6
    Quote Originally Posted by Rivanni View Post
    Use the mouse down event to capture the X and Y coordinates. Not that difficult.
    Thx,

    would you be able to provide me with a code example plz ?

  8. #8
    Rivanni is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    9
    You could have searched the internet for how to use the MouseDown event.
    But I'm in a good mood so here a tiny example.

    The name of the image on the form in is imgHumanBody.
    If you select the MouseDown event from the forms properties list all arguments are automatically filled in.

    Button gives the value of the mouse button that is clicked (left, right, middle).
    Shift gives the value of the special key that was pressed when ther was a click (shift, alt, ctrl).


    Code:
    Private Sub imgHumanBody_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        
        If X < 100 And Y < 100 Then
            MsgBox "You clicked somewhere in the top left of the image"
        Else
            MsgBox "You clicked on coordinate " & X & "," & Y
        End If
        
    End Sub

  9. #9
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,840
    the image mousedown event looks like

    Code:
    Private Sub myImage_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    End Sub
    the X and Y are the X Y coordinates of the mouse in relation to the top left of the image

    So if you wanted an 'X marks the spot', create a label with X as the caption, text centred, control sized to suit with a transparent background and make it hidden. we'll call it lblX. Also ensure the image control has been 'sent to back' and/or lblX is 'brought to front'

    then your image mousedown event becomes

    Code:
    Private Sub myImage_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    lblX.top=Y+myImage.top-lblX.height/2
    lblX.left=X+myImage.left-lblX.width/2
    lblX.visible=true
    
    End Sub
    if you want to store the information for future reference, store the lblX top and left values in a table - clearly only relevant to the appropriate image and image control size.

    I

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    So far not as difficult as I thought. Saving the coordinates would also be simple.

    However, I don't see how retrieving x and y coordinates could be used to automatically save specific text into record. User could manually input comment to a textbox. But there would be only one textbox, not multiple 'hidden' textboxes that would be made visible depending on where the mouse clicked.

    In fact, your thought about multiple hidden textboxes makes me suspect your data structure is not normalized.
    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.

  11. #11
    Ziploc is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    6
    Thank you all for so far provided help.

    June7 is right....the data structure is not really normalized.....

    I might be able to choose about 60 specific areas....but at that number I'm as good doing it free handed....



    Rivanni thx for your kindness...I did lookup the function but the challenge that I see is to store the data after and be able to retrieve it in a easy way....the best would be

    to create a label, that's somehow stored, and make it ''stick" to the background forever....

    and I'm far from being a Access or VBA pro.....I can modify code, maybe reverse engineer it a bit but I'm far from coding that from the scratch....

  12. #12
    Ziploc is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    6
    Also the strategy behind the tables structure must be planned....

    I think that

    1 table should contain the coordinates when created,
    1 table for the "labels"

    and then I would have to make relations to link all that to the ''body outline form'' which is already a sub form of patients form....

    Is this looking ok ?

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

Similar Threads

  1. Image in Background panel
    By jopi in forum Access
    Replies: 1
    Last Post: 05-31-2014, 11:17 AM
  2. Issue with image background
    By DarrenUD in forum Reports
    Replies: 2
    Last Post: 03-14-2013, 02:51 AM
  3. Changing background image by date range
    By Monterey_Manzer in forum Forms
    Replies: 4
    Last Post: 09-27-2012, 11:52 AM
  4. Background Image on Tabbed Form
    By Keeper in forum Access
    Replies: 3
    Last Post: 05-01-2012, 07:57 PM
  5. Issue with background image on form
    By sbrookebounds in forum Access
    Replies: 3
    Last Post: 01-20-2011, 02:53 PM

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