Solved

Change font color on a form field

Posted on 2014-12-19
7
102 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
  • 3
  • 2
  • 2
7 Comments
 
LVL 35

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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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 35

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now