Solved

Change Background Color Of Form Based On Data

Posted on 2008-06-22
5
2,676 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
[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
5 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 21843860
Hello NttNschu,

Have a look at Conditional Formatting.

Regards,

Patrick
0
 
LVL 14

Expert Comment

by:ldunscombe
ID: 21844680
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
ID: 21845014
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
ID: 21849889
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
ID: 21851022
Thanks Heaps for your help guys.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 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