?
Solved

In Access control whether image displays

Posted on 2014-04-14
3
Medium Priority
?
412 Views
Last Modified: 2014-04-14
Have an Access Report where the record source is a table (Tbl_xyz) having 2 text fields.

Tbl_xyz records are:

ID    Field 1     Field 2
1     Blue         (Null)
2     Green      c:\green.jpg
3     Brown     (Null)

Would like report to list all records in Detail section, but for record #2 display the image located in Field 2 and then proceed to contents of record #3. So, I inserted an Image Control in the detail section and made the control source Field 2.

By inserting an image control in the detail section, the image frame creates additional space in those lines where there is no image. Is there a way to conditionally make that image frame visible? In other words, records #1 and #3 don't have images.  I don't want the space created by the image frame to be visible. Thanks!
0
Comment
Question by:clock1
[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
  • 2
3 Comments
 
LVL 22

Expert Comment

by:Flyster
ID: 40000605
Try this code in the Format section of the detail section:

If Len(Me.Field2.Value) > 0 Then
  Me.Detail.Height = 1000
  Me.Image1.Height = 500
Else
  Me.Detail.Height = 500
  Me.Image1.Height = 250
End If

Just change Image1 to the name of the image control in your report and the height values to what you need.

Flyster

P.S.
Thanks for the previous points!
0
 

Author Comment

by:clock1
ID: 40000625
Flyster

Points were well deserved, and you're welcome.
Is your suggestion to use code in the image property, or On Current event of Report, or On Print event of Detail section?
0
 
LVL 22

Accepted Solution

by:
Flyster earned 2000 total points
ID: 40000633
In design view, right-click the detail section of your report and select properties. Under the event tab, select On Format and paste the code there.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

765 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