Solved

Change Background Color Of Form Based On Data

Posted on 2008-06-22
5
2,643 Views
Last Modified: 2013-11-28
Hey Experts, I am asking this on behalf of a friend.
She wants to change the color of a form in an access 2003 database if it is overdue?
we found:
   if me.yourformfield > aCertainnumber then
       detail.backcolor = vbred  
    else
       detail.backcolor = 16777215
    end if

at http://forums.aspfree.com/microsoft-access-help-18/change-background-color-of-form-based-on-data-215704.html
however it causes all the forms to change colour.

Any help would be muchly appreciated.
0
Comment
Question by:NttNschu
5 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
Comment Utility
Hello NttNschu,

Have a look at Conditional Formatting.

Regards,

Patrick
0
 
LVL 14

Expert Comment

by:ldunscombe
Comment Utility
I don't understand why you are having a problem.

I tested this in the OnCurrent event of one of my forms and it worked no problem.

  If Me.ID > 15 Then
       Detail.BackColor = vbRed
    Else
       Detail.BackColor = 16777215
    End If

All I would ask is Where are you putting your code.

Leigh
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
NttNschu,

<however it causes all the forms to change colour.>

First, I think you mean, you have a continuous form, and all the *records* are the same color.

What you are asking is difficult to do with a continous form.
You can look here if you are good with modifying vba code:
http://www.lebans.com/alternatecolordetailsection.htm


If I were you, I would just set the "Control" to change color.
Use conditional formatting for this as matthewspatrick suggested.

Select Your Form Field, then Click: Format-->Conditional formatting
Box1: If Field Value is
Box 2: Equal to
Box 3:  A_Certain_Value

The just set the BackColor to Red.

Give the points to matthewspatrick, if you decide to go with this technique.

JeffCoachman
0
 
LVL 13

Expert Comment

by:wiswalld
Comment Utility
I agree if you are using a continious form then try conditional formatting. Maybe just set one of the fields backcolor to red.
0
 
LVL 1

Author Comment

by:NttNschu
Comment Utility
Thanks Heaps for your help guys.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
EXCEL 2010 7 38
Spell checking an unbound form in MS Access 2013 9 35
Text Value from Time 3 21
Run-time 91 error, not sure why 3 21
In case Office 2010 has not been deployed in your environment, this article may be quite useful. In our office, we wanted a way to deploy Microsoft Office Professional Plus 2010 through an automated batch file via logon script. This article is docum…
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
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.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

763 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