Solved

Change font color on a form field

Posted on 2014-12-19
7
101 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 34

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 119

Expert Comment

by:Rey Obrero
ID: 40509861
is the current event of your form firing?
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 40509865
what are the other codes in the current event of the form?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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 34

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

861 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

23 Experts available now in Live!

Get 1:1 Help Now