Solved

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

Posted on 2008-06-26
7
236 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

708 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

17 Experts available now in Live!

Get 1:1 Help Now