Solved

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

Posted on 2008-06-26
7
290 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

626 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