Results 1 to 5 of 5
  1. #1
    capitala is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2013
    Posts
    11

    Show/ hide image based on some field value

    Good Day,
    in my report, I have two unbound images. I wish to show only one of them based on some field value. i.e. if the completion percentage exceeds 50% then the first image is visible and the second is invisible. and if it's less than 50% the first image is invisible and the second is visible.
    how to do that?

    Thanks

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Set both the images' visibility to "No"
    In the report's open event use the following code -
    Code:
    If [completion percentage control name] >50 then
         Me!Image1.visible =true
    Else
        Me!Image2.visible =true
    Endif

  3. #3
    capitala is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2013
    Posts
    11
    Actually I've tried this but it will be visible or invisible for all records not only for the relevant record.

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Conditional Formatting not available for Image or OLE Object controls.

    Luckily, you are using Access 2007 which introduced the ControlSource property to Image control.

    If the report is displaying continuous records (as opposed to filtering to one record) then suggest options:

    1. A table that has the two images embedded in two attachment fields. If the report RecordSource is an SQL statement, save that SQL as an Access query object. Then make the report RecordSource a query that joins the table to the saved query without join clause and this one record will join to every record of the primary data source. Then an IIf expression in ControlSource property of Image control to select the desired field.

    or

    2. Images saved externally and also an IIf expression in ControlSource property of Image control to selected the desired image.

    RATS! I can get 2 working but not 1.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Hide field in sub-report based on condition
    By vinsavant in forum Reports
    Replies: 4
    Last Post: 12-16-2012, 10:18 AM
  2. Combo Box value hide/show Image
    By alyon in forum Access
    Replies: 7
    Last Post: 12-13-2012, 09:48 AM
  3. Replies: 4
    Last Post: 03-02-2012, 08:41 AM
  4. show / hide columns based on criteria?
    By stevepcne in forum Access
    Replies: 1
    Last Post: 11-18-2011, 02:49 PM
  5. Replies: 6
    Last Post: 02-24-2011, 03:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums