Results 1 to 3 of 3
  1. #1
    FL0XN0X is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Belgium
    Posts
    84

    How to set background color of textbox which is sum of two other textboxes based on a query

    Hi,

    I have got a query on which I have built a continuos form. The form contains textboxes which values I need to add. Thus, eg. textbox1 holds '1', textbox2 holds '5', so I create a textbox3 that is the sum of both textboxes 1 en 2, resulting in '6'. Now I need to set conditional formatting on the textbox; ie. if the extbox value exceeds a certain threshold, the backcoler property must change.

    Code may look like:

    If me.textbox3 > threshold
    then textbox3.backcolor= RGB(255,0,0)
    Else textbox3.backcolor= RGB(0,255,0)
    End If

    But where do I need to put the code since the query first need to be ended ...

    Thank you in advance.
    Kind regards,
    Bart

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Use Conditional Formatting, not VBA.
    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.

  3. #3
    FL0XN0X is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Location
    Belgium
    Posts
    84
    Thnx !!! I just found the conditional formatting !!

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

Similar Threads

  1. Change Text color and/or background color
    By Thompyt in forum Reports
    Replies: 2
    Last Post: 02-23-2017, 07:08 PM
  2. Replies: 2
    Last Post: 10-13-2016, 08:54 AM
  3. Replies: 7
    Last Post: 06-26-2014, 01:41 PM
  4. Replies: 2
    Last Post: 08-14-2013, 04:29 PM
  5. Replies: 5
    Last Post: 06-28-2013, 06:11 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