Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    7

    Unanswered: Changing font color in text box

    This question was sort of addressed last month but not quite the same--anyway here goes--Access2000--report with outstanding balances. I want the text in <txtAmountDue> to be BLACK if it is Less Than 30 Days Past Due. If it is Over 30 days i would like the font to be in RED. txtAmountDue is a bound control from the outstanding balance query. Is that enough info? Any help would be greatly appreciated!! Thanks

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    In the OnFormat event for the Report section (usually Detail) that contains the txtAmountDue field:

    Code:
    If Over30DaysDue Then
       Me.txtAmountDue.ForeColor = vbRed
    Else
       Me.txtAmountDue.ForeColor = vbBlack
    End If
    Note: Over30DaysDue must be something (a field either visible or hidden) within your report that can be referenced.

    For example, if you have a field within your report that indicates the amout due is Over 30 days, such as a TextBox named OverDue then we need to check that to determine whether or not to change the font color. If the field name is indeed named OverDue then our code would look like so:

    Code:
    If Me.OverDue > 30 Then
       Me.txtAmountDue.ForeColor = vbRed
    Else
       Me.txtAmountDue.ForeColor = vbBlack
    End If
    If you want this to apply to a Form rather than a report then place the code into the OnCurrent event of the Form.

    Hope this helps

  3. #3
    Join Date
    Jan 2004
    Posts
    7
    Thank you so much! Cant any simplier, eh??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •