Results 1 to 4 of 4
  1. #1
    Chetnole_Ian is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    2

    How can I automatically extend an image frame height?

    The records in the maintable of my MS Access 2010 database include an Attachment field which links to a ‘.jpg’ image. These imagesare all a fixed width but variable in length. In the Report Design I have animage frame set to this width and about 2 cm high. If the original image heightis greater than this frame height, then Access reduces the image in size to fit withinthe frame. I would like the frame to extend in height automatically so that theimages are shown full size. (This would be a different amount for eachrecord in the report – a bit similar to the ‘Can Grow’ property on a Textfield.) Presumably I need a bit of VBA code that sets, for each record, the imageframe height to the associated image height.
    What Event property should be set to automatically actionthe code? What code would be needed andwhat would be the best way to call it? I am new to VBA, so please be patient! Thanks.


  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Not sure this can be done. I just attempted some code to set the height of textboxes. The height setting was applied to all instances of textbox, did not adjust for each record. The event to place code in would be Format of the Detail section. Good Luck. BTW, units for setting Height property is TWIPS - 1440 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.

  3. #3
    Chetnole_Ian is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    2
    Quote Originally Posted by June7 View Post
    Not sure this can be done. I just attempted some code to set the height of textboxes. The height setting was applied to all instances of textbox, did not adjust for each record. The event to place code in would be Format of the Detail section. Good Luck. BTW, units for setting Height property is TWIPS - 1440 per inch.
    Hello June7 and thanks for your reply. I added a bit of code called by the ‘On Format’ Event of the Detail Section, as you suggested - basically: Images.Height = PicImage.ImageHeight
    I got the error 'Error 438 Object does not support this property or method' when going into the Print Preview of the Report
    . So I suppose this confirms there is just no way to dynamically alter the frame size of an image field on a record by record basis - or is my line of code incorrect (PicImage being my name for the image Attachment field)?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Review
    http://msdn.microsoft.com/en-us/libr.../ff197639.aspx
    It has sample code to adjust height of image control on a form, probably in Single View. It says the code will set height of control holding a bitmap image. Don't know if would work for other other image types. I can't get code to work.
    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: 4
    Last Post: 09-15-2012, 07:31 PM
  2. Replies: 3
    Last Post: 07-31-2012, 06:05 AM
  3. Replies: 1
    Last Post: 05-30-2012, 03:51 PM
  4. Replies: 2
    Last Post: 10-10-2011, 10:58 AM
  5. Replies: 0
    Last Post: 04-22-2011, 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