Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

Check the display size of an image on an Access Form Macro

Can someone help me with a way to create a button on an Access form that checks the display size of an image on the form?
0
npl77
Asked:
npl77
  • 3
  • 2
  • 2
1 Solution
 
RgGray3Commented:
Do you mean the display resolution of the monitor or of a graphic image placed on a form
0
 
npl77Author Commented:
graphic image displayed on the form
0
 
RgGray3Commented:
I was afraid of that....

To my knowledge it isn't available due to the fact that when you store a graphic...  Access converts it....  (I believe it is stored as a BMP) and I do not believe there is any way to retrieve its height and width....  

Sorry I can't be of more help
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Jeffrey CoachmanCommented:
npl77,

RgGray3 is correct, this is very tricky because of the way Access can "size" an image.
(Clip, stretch, Zoom)

So the numbers you will get with the original image might differ from the numbers you get once you put the image in Access and start "manipulating" it.

For example, if you have an image that is 640x480, you can move it into Access and "zoom" it.

You can make it bigger or smaller on the screen, but the original image size (Internally) for Access, will be the same.

So if you are trying to use the "size" in Access to tell you the original image size, then it may not be accurate.

Also confusing things is the fact that, for me, Access lists the image dimensions in inches in the Property box.
Yet when you I do this:
msgbox me.MyImage.Height
&The measurement is in Twips!

So,&

If all you want is the physical "size" of the image on the Access "form", you can use code like this:

Dim imgWidth As Long
Dim imgHeight As Long

imgHeight = Me.YourImage.Height
imgWidth = Me.YourImage.Width

MsgBox "Image Height in Twips: " & imgHeight _
        & vbCrLf & "Image Width in Twips: " & imgWidth _
        & vbCrLf & "Image Height in inches: " & imgHeight / 1440 _
        & vbCrLf & "Image Width in inches: " & imgWidth / 1440 _
        & vbCrLf & "Image Height in Pixels: " & imgHeight / 15 _
        & vbCrLf & "Image Width in Pixels: " & imgWidth / 15


JeffCoachman
0
 
npl77Author Commented:
Ok  say I use this code. How do I get a reference to the image displayed on the form. The image is coming into the form by simply dragging the image filed on the form, there is no code putting it there. Access does it automatically. So when I search through the reocords on the bottom of the form it simply displays the image for that record in the db.
0
 
npl77Author Commented:
Also, can your code display the image size in bytes?
0
 
Jeffrey CoachmanCommented:
npl77,

For my code I used a standard Image control.
<How do I get a reference to the image displayed on the form. The image is coming into the form by simply dragging the image filed on the form, there is no code putting it there. >
What type of field is this defined as in the underlying table?
What type on control is it?

JeffCoachman
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now