Solved

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

Posted on 2008-06-26
7
267 Views
Last Modified: 2013-11-27
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
Comment
Question by:npl77
  • 3
  • 2
  • 2
7 Comments
 
LVL 11

Expert Comment

by:RgGray3
ID: 21876445
Do you mean the display resolution of the monitor or of a graphic image placed on a form
0
 

Author Comment

by:npl77
ID: 21876534
graphic image displayed on the form
0
 
LVL 11

Expert Comment

by:RgGray3
ID: 21876671
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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 21881156
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
 

Author Comment

by:npl77
ID: 21900344
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
 

Author Comment

by:npl77
ID: 21900355
Also, can your code display the image size in bytes?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 21902622
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now