Unanswered: Image Boxes & Conditional Formating in Reports
Is there a way to set conditional formatting for an image box in a report?
I'm trying to print photographs on a report. I have the dimensions of the image box set at 5" wide x 3" tall. This works fine for the photos oriented in this fashion (landscape). However, for photos oriented in the opposite direction, 5" tall x 3" wide (portrait), it doesn't work.
What I'd like to do is have the dimensions of the image box be dependent on a field denoting the photo orientation, such as:
Imagebox width = 5"
Imagebox height = 3"
Imagebox width = 3"
Imagebox height = 5"
Is this even possible? Obviously I need help with the code. Thanks!
You have the right idea....just get rid of the inches. Everything in a Report is formated by way of 'Twips' even though in design view you set and see everything in inches (or cm's). you have to convert the inches to twips. Always remember...1" is equal to 1440 twips. Therefore, 5" = (5 * 1440). with this in mind our code would look like this:
If Me.Orientation = "Landscape" Then
Me.Imagebox.Width = 5 * 1440
Me.Imagebox.Height = 3 * 1440
Me.Imagebox.Width = 3 * 1440
Me.Imagebox.Height = 5 * 1440
You need to place this code into the 'Format' event of whatever report "section" your Image box resides (i.e.: Page header, Report Header, Detail, etc., etc.). Please note....the code above will make your image box Full Scale on your paper.