Results 1 to 9 of 9
  1. #1
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272

    Format text colour to white when the field contains a zero (0) figure.


    I will like to format my access database report in such a way that, when the amount in the textbox is zero, it should change the color of the text to white so it won’t be visible on the report.

    How do I go about that?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    In the ON PRINT event of the report,

    TxtBox.visible =txtbox >0

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    I'd probably use Conditional Formatting?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Quote Originally Posted by Welshgasman View Post
    I'd probably use Conditional Formatting?
    Can you demonstrate the conditional formatting?

  5. #5
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Quote Originally Posted by ranman256 View Post
    In the ON PRINT event of the report,

    TxtBox.visible =txtbox >0
    This method couldn’t produce the results I wanted

  6. #6
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Quote Originally Posted by Welshgasman View Post
    I'd probably use Conditional Formatting?
    I tried the conditional formatting
    And it worked great
    Thanks for this idea

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Quote Originally Posted by Emmanuel View Post
    This method couldn’t produce the results I wanted
    For that method you would set the textbox visible property to false by default. Then it would only be visible if the textbox value >0.
    The advantage of that method is it would still be hidden as you wanted even if the paper used wasn't white. Using CF, you would see the white 0 on coloured paper.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #8
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    @isladogs
    Well noted

  9. #9
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Or use the format property which technically will be quicker than conditional formatting

    Something like

    ,,’’

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

Similar Threads

  1. Changing colour of text
    By Macaw in forum Forms
    Replies: 5
    Last Post: 09-09-2019, 03:00 AM
  2. Formatting Text colour on resul
    By CraigR in forum Access
    Replies: 2
    Last Post: 05-26-2019, 12:17 PM
  3. Replies: 2
    Last Post: 07-09-2014, 06:41 PM
  4. Changing text box back colour
    By Duncan in forum Forms
    Replies: 3
    Last Post: 02-23-2013, 05:32 PM
  5. Changing Text colour on value amount
    By stu_C in forum Forms
    Replies: 1
    Last Post: 08-08-2011, 06:58 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