Results 1 to 6 of 6
  1. #1
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150

    Enlarging Image

    I have four small images on this form. When I click on one, it gets enlarged, and when clicked again, it goes back to the original size. I've already code it using ctrl.Move and global variables to store original image dimensions, so that the the original image size can be restored whenever the larger image is clicked. The problem is that I am constantly adjusting the code to try to make the image an optimal size, so I would play with the location of image and the size by changing the codes.



    Then I thought, perhaps I've made it much more complicated than it has to be. I could have just make another image control on the form with much larger dimension and make it visible and invisible matching the image of the smaller image whenever a smaller image is clicked. Maybe it's from lack of sleep last night, but for the life of me, I can't think of a way to pass the control source. So to clarify myself, ImgSmall1 has a control source of [imgFront], when I click on that image, I want the larger image to have the control source of [imFront]. That's pretty simple, right?

    Sleep Deprived

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Are there two fields - imgFront and imFront? Or should that second reference have been imgFront.

    I don't really understand issue. If you have two Image controls on the form and just need to control visibility, shouldn't they each be bound to same field?
    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
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150
    No, I have four small images, and I want to see whichever smaller image enlarged when clicked. Therefore, imgLarge = imgFront, or imgLarge = imgBack, ...depending on which image is clicked.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Are these images embedded in Attachment type field of table?

    Maybe in small image Click event something like:

    Sub imgFront_Click()
    Me.imgLarge.ControlSource = "imgFront"
    Me.Refresh 'might not be necessary
    End Sub
    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
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150
    Ha, that's exactly what I initially did, but .ControlSource, for some reason, is not an available method.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Rats! Can build a function that is called from the Image control ControlSource property. I tested with an Image control and a Button.

    Option Compare Database
    Dim strImage As String

    Private Function GetImage()
    GetImage = strImage
    End Function

    Private Sub Command115_Click()
    strImage = "C:\Users\June\Queries.png"
    Me.Refresh
    End Sub

    However, that is pulling external image. As you discovered, I also don't see any way to programmatically set the ControlSource property to a field name. Annoying.

    Only alternative I see is 4 corresponding large images and manage their visibility with code.
    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: 3
    Last Post: 07-13-2015, 12:07 PM
  2. Replies: 2
    Last Post: 10-10-2011, 10:58 AM
  3. Image help?
    By ndynamo in forum Reports
    Replies: 1
    Last Post: 01-12-2011, 04:42 PM
  4. Image in a Report
    By Kapelluschsa in forum Reports
    Replies: 3
    Last Post: 10-27-2010, 09:01 AM
  5. If statement for image
    By turbo910 in forum Forms
    Replies: 1
    Last Post: 11-30-2009, 04:58 AM

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