Results 1 to 5 of 5
  1. #1
    Lycanthrop's Avatar
    Lycanthrop is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Posts
    3

    Howto make a field not visible by event?

    Hey!


    I'm struggling to make a field not visible in a report (if it's value is 0).


    Tried the following code (in Detail | Event | On Format) but no luck: =IIf([Discount]=0;([Discount].[Visible]=False);([Discount].[Visible]=True))

    Nor does this simple code work: =[Discount].[Visible]=False



    Any ideas?

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Where are you putting this? It looks like you are trying to do a calculated field. "Visible" is a property, not a field (so would not be enclosed in brackets), and you would not put this in the Control Source.

    Actually, I think the easiest way to do this is with Conditional Formatting (requires no VBA). Just select the field, right click and select Conditional Formatting, and when the value is zero, select the text color to match the background color (usually white). Then it will not be visible when it is zero.

  3. #3
    Lycanthrop's Avatar
    Lycanthrop is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Posts
    3
    Many thanks JoeM, worked perfectly! I was not aware of the Conditional Formatting function


    The code was put in the report under Detail | Event | On Format. The brackets appeared automatically.

    Also I have a text box (under the
    GroupHeader0) that needs to be invisible when all the values are 0 in one particular field under Detail. Is it possible to use the Expression Builder to produce a code that changes the .visible property (or color) for this field?

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Note that under Conditional Formatting, there is an "Expression Is" option. So you could enter an expression like:
    Code:
    ([Field1]=0) And ([Field2]=0) And ...
    See this for more details: http://office.microsoft.com/en-us/ac...010208133.aspx

  5. #5
    Lycanthrop's Avatar
    Lycanthrop is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Posts
    3
    Thanks for the additional info JoeM!

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

Similar Threads

  1. Make Report Label Visible (or not)
    By libraccess in forum Reports
    Replies: 5
    Last Post: 11-02-2013, 07:50 PM
  2. Replies: 2
    Last Post: 10-21-2013, 03:50 PM
  3. Replies: 5
    Last Post: 07-05-2013, 06:08 AM
  4. Replies: 31
    Last Post: 08-15-2012, 03:33 PM
  5. Replies: 2
    Last Post: 01-06-2011, 04:38 AM

Tags for this Thread

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