Solved

Change font color on a form field

Posted on 2014-12-19
7
106 Views
Last Modified: 2014-12-19
Why isn't this working?  I have it in the oncurrent event of a form

    If Me.txtActualHours.Value > Me.txtSchedHours.Value Then
        Me.txtHrVariance.ForeColor = vbRed
        Else
        Me.txtHrVariance.ForeColor = vbBlack
    End If

Open in new window

0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 38

Expert Comment

by:PatHartman
ID: 40509852
Looks OK to me.  Do you have any compile errors?  Put a stop in the code on line 1 and then check the values in all the fields.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40509861
is the current event of your form firing?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40509865
what are the other codes in the current event of the form?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:SteveL13
ID: 40509882
Compiled fine.  Also did compact and repair for kicks.

First of all I removed .Value because when I hovered over I got type mismatch.
After putting a stop on line 1 and hover over fields I get:
Me.txtHrVariance.ForeColor = 0 on lines 1, 2, and 4

Yes, I believe the current event is firing

No other code in the current event.
0
 

Author Comment

by:SteveL13
ID: 40509929
Example db attached.

Need to somehow...

If Me.txtActualHours.Value > Me.txtSchedHours.Value Then
        Me.txtHrVariance.ForeColor = vbRed
        Else
        Me.txtHrVariance.ForeColor = vbBlack
    End If
Test-DB.zip
0
 
LVL 38

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40509962
The problem is that you are doing this in a form in data sheet view (continuous won't work either).  You need to use conditional formatting.Conditional Formatting
0
 

Author Comment

by:SteveL13
ID: 40509999
Yep again.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question