Solved

Change font color on a form field

Posted on 2014-12-19
7
100 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
Comment Utility
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
Comment Utility
is the current event of your form firing?
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
what are the other codes in the current event of the form?
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:SteveL13
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Yep again.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

772 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

9 Experts available now in Live!

Get 1:1 Help Now