Results 1 to 10 of 10
  1. #1
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727

    Currency Text Box Fore Color Issue

    This is a long shot but I am out of ideas. Hopefully someone might know how to figure this out.


    I have a currency text box that is bound to a backend table. Right now it calculates the change based on a few other text boxes. These text boxes are the amount due, cash given, check, and charge. If the amount due is more than what the customer pays then the change text box fore color will be red to indicate that the customer still owes more money. If the payment covers all of the amount due then the change text box fore color will be white which is what I set myself for the text box to be in the first place. Lastly, if the customer over pays then the change text box fore color turns green to indicate that the clerk needs to give change to the customer. The change text box is also transparent and the clerk is not allowed to edit this field.


    So everything is working fine but the problem I'm having is I would like to change the red and green colors that it changes when the customer has under/over paid. For the life of me, I cannot find the VBA code that is making this happen and I also checked all the properties incase I set something up there that I forgot about. I tried testing the amount due text box as it's set up in a similar way and I put in a negative number to replicate the scenario of the change text box if the customer under paid just to see if there was some kind of automation running for negative numbers if the text box was for currency and this did not change the fore color of the amount due text box and so that probably isn't the case here. I tried looking in the table where the record is held in design view to see if there was anything and I couldn't find anything.


    If anyone has any suggestions please let me know. I even did a CTRL+F in the VBA window for the form itself hoping that maybe it was in the On Current event or something like that but I couldn't find anything that messes with the fore color for the txtChange text box.




    This is driving me nuts that I can't find something so simple. Any help is appreciated.

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Is this red text or red background? One option would be to open vb editor, click anywhere in code, do ctrl+f and search for "forecolor" (for text) or "backcolor" (for control background) - but set the option for the whole project, not either of the other 2 options. Likely you'll find what you're looking for is in the form module code so you could just search that first if you want, but there's no guarantee that it is not in a standard module instead.
    I have a currency text box that is bound to a backend table. Right now it calculates the change based on a few other text boxes.
    Not truly possible as described because a bound control cannot have an expression (a calculation) for its controlsource property.
    EDIT - while that is true AFAIK, perhaps you meant the calculation is done in code and not the control itself.
    Last edited by Micron; 11-10-2022 at 08:20 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    CarlettoFed is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2019
    Posts
    274
    Maybe if you attach a sample file it is easier to help you.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Check the Conditional Formatting settings of the textbox
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Check the Conditional Formatting settings of the textbox.
    See: https://support.microsoft.com/en-us/...d%20click%20OK.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Bob Fitz View Post
    Check the Conditional Formatting settings of the textbox
    OMG!!! There it is! You don't realize how happy this makes that you were able to solve it. Thank you 10 zillion times. This stupid thing was driving me insane for the past few days. lol I am an idiot. I developed this txtChange text box years ago so I totally forgot I did a conditional formatting setup on this. Nowadays I would just use VBA. Thanks again!

  7. #7
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Micron View Post
    Is this red text or red background? One option would be to open vb editor, click anywhere in code, do ctrl+f and search for "forecolor" (for text) or "backcolor" (for control background) - but set the option for the whole project, not either of the other 2 options. Likely you'll find what you're looking for is in the form module code so you could just search that first if you want, but there's no guarantee that it is not in a standard module instead.
    Not truly possible as described because a bound control cannot have an expression (a calculation) for its controlsource property.
    EDIT - while that is true AFAIK, perhaps you meant the calculation is done in code and not the control itself.
    Thank you very much for this suggestion. I tried it and found some other errors I want to clean up but it didn't find what I was looking for. Turns out it was in conditional formatting. Thank you for trying to help though. It's good to know I can search the whole project now cause I didn't even realize the option was there when I did CTRL+F intially. lol

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Quote Originally Posted by data808 View Post
    OMG!!! There it is! You don't realize how happy this makes that you were able to solve it. Thank you 10 zillion times. This stupid thing was driving me insane for the past few days. lol I am an idiot. I developed this txtChange text box years ago so I totally forgot I did a conditional formatting setup on this. Nowadays I would just use VBA. Thanks again!
    Always glad to help if I can.
    Out of curiosity..... why would you use code in preference to this way?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  9. #9
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    Doesn't sound like you are doing this here but instead of conditional formatting you can use the format property to change the forecolor.

    For numbers the colour can be set for positive;negative;zero;null. You can also show a simple message.

    So if you want green for positive, red for negative and a message 'no change required' for zero the format property would be

    [Green];[Red];"no change required"

    or if you just don't want to display anything when zero, use

    [Green];[Red];""

    Since this is a calculated value, I'm assuming null is not an option

  10. #10
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Bob Fitz View Post
    Always glad to help if I can.
    Out of curiosity..... why would you use code in preference to this way?
    To keep most of the controls in one place so I know where to find it. lol

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

Similar Threads

  1. Replies: 7
    Last Post: 01-19-2021, 10:08 AM
  2. Fore Name and Or surname
    By DMT Dave in forum Access
    Replies: 6
    Last Post: 07-16-2020, 10:51 AM
  3. Using Currency in text string.
    By Homegrownandy in forum Queries
    Replies: 4
    Last Post: 05-12-2017, 07:22 AM
  4. Change Text color and/or background color
    By Thompyt in forum Reports
    Replies: 2
    Last Post: 02-23-2017, 07:08 PM
  5. Back color update issue
    By GraemeG in forum Programming
    Replies: 3
    Last Post: 03-21-2011, 11:32 AM

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