Results 1 to 8 of 8
  1. #1
    Jan-Erik is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    6

    Image control reporting .ImageHeight and ImageWidth = 0

    Hi,
    Trying to get the the height and width of Picture (file) showed in an Image Control on a Form (file path & -name in a textfield in db).
    The problem is that .ImageHeight and .ImageWidth always return zero.
    Tested .jpg; .gif ; .bmp images but always get zero for these two properties.


    The form is a show only one record.
    Using Access 2013.

    Ex:
    Private Sub btnTest_Click()
    msgbox MyOnlyImageControlOnThisForm.ImageHeight
    end sub

    What did I miss, please?

    Thanks!

    Best Regards
    Jan

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I was able to get the following to work...
    Code:
    Debug.Print Me.Image1.ImageHeight
    MsgBox Me.Image1.Height
    
    Debug.Print Me.Image1.ImageWidth
    MsgBox Me.Image1.Width
    Maybe your control is corrupt. By the way, it seems to have returned Twips and not inches or ...

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    1440 TWIPs per inch.
    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.

  4. #4
    Jan-Erik is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    6
    Thank you ItsMe and June7!
    I'll keep trying....
    The purpose is only to know if it is a landscape- or portrait oriented picture to select different reports for print so twips is ok.

    best regards
    Jan

  5. #5
    Jan-Erik is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    6
    Hi,
    Discovered that the Imageheight and -width properties reports correct if picture file name is loaded into the 'Picture'-property but not when the Image Control is linked to a text field in the DB through 'ControlSource'-property.
    Strange to me.
    Anyway - a workaround then is possible this way.

    Best Regards
    Jan

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Before Image control had a ControlSource property (introduced with Access 2007), dynamic display of images on report required VBA code to set Picture property. Is that the solution you went with?
    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.

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If you need the extended properties of a file on a server or your PC, there may be a way to get the info via a Windows API. Maybe reference Shell in your Access app and go after the file's extended properties.

  8. #8
    Jan-Erik is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    6
    Hi June7,
    Did a Dirty load into 'Picture'-property of Image when user 'opens' a Picture and stores its path to DB.
    While Picture property has Picture file path, I save Image height and -width i DB to use later for filtered (H/W < 1;H/W >=1) report portrait or landscape depending on pic-format.
    Then clearing Picture property again

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

Similar Threads

  1. zoom control for image on form
    By oldtiredjeffro in forum Forms
    Replies: 7
    Last Post: 10-20-2014, 03:30 PM
  2. Image Control with Filepath as Source
    By tennislvr7 in forum Forms
    Replies: 1
    Last Post: 01-22-2014, 10:59 PM
  3. SetFocus on Image Control??
    By tylerg11 in forum Forms
    Replies: 1
    Last Post: 07-21-2012, 03:32 PM
  4. Image List Control
    By Fredwards in forum Access
    Replies: 2
    Last Post: 11-23-2010, 10:30 PM
  5. Image control in MS Access
    By celestialcitizen in forum Forms
    Replies: 6
    Last Post: 07-03-2009, 03:25 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