Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Change Background Color Of Form Based On Data

Posted on 2008-06-22
5
Medium Priority
?
2,688 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 93

Accepted Solution

by:
Patrick Matthews earned 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

New style of hardware planning for Microsoft Exchange server.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

886 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