Solved

In Access control whether image displays

Posted on 2014-04-14
3
376 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
  • 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 500 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 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

15 Experts available now in Live!

Get 1:1 Help Now