Solved

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

Posted on 2008-06-26
7
275 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

830 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