473,387 Members | 1,440 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

combo box backcolor

I am wanting to have the backcolor of some combo boxes change acording
to what value is in the combo boxes in a report. The report can be
one page to multiple pages with the same combo boxes on each page.
The code I have tried is below.

Sub Form_Current()
Dim green As Long, yellow As Long, red As Long
Dim x As Long
green = RGB(0, 255, 0)
yellow = RGB(255, 255, 0)
red = RGB(255, 0, 0)
x = 1
Do
Me.Page = x
If Me![Neck & Shoulder Force] = "High" Then
Me![Neck & Shoulder Force].BackColor = red
Else
End If
If Me![Neck & Shoulder Force].Value = "Moderate" Then
Me![Neck & Shoulder Force].BackColor = yellow
Else
End If
If Me![Neck & Shoulder Force] = "Low" Then
Me![Neck & Shoulder Force].BackColor = green
Else
End If
x = x + 1
While x <= Me.Pages
End Sub

It's been a while since I've programmed so any help would be
beneficial. Thanks.

Matt
Nov 13 '05 #1
1 2490
See reply to Dwight posted a few minutees ago, topic: Chnage Colour in Combo
Box. Seems to be the same issue.

"Matt" <ml*****@ksu.edu> wrote:
I am wanting to have the backcolor of some combo boxes change acording
to what value is in the combo boxes in a report. The report can be
one page to multiple pages with the same combo boxes on each page.
The code I have tried is below.

Sub Form_Current()
Dim green As Long, yellow As Long, red As Long
Dim x As Long
green = RGB(0, 255, 0)
yellow = RGB(255, 255, 0)
red = RGB(255, 0, 0)
x = 1
Do
Me.Page = x
If Me![Neck & Shoulder Force] = "High" Then
Me![Neck & Shoulder Force].BackColor = red
Else
End If
If Me![Neck & Shoulder Force].Value = "Moderate" Then
Me![Neck & Shoulder Force].BackColor = yellow
Else
End If
If Me![Neck & Shoulder Force] = "Low" Then
Me![Neck & Shoulder Force].BackColor = green
Else
End If
x = x + 1
While x <= Me.Pages
End Sub

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Prakash Wadhwani | last post by:
I have a form (continuous) with a few fields : First Name, Last Name, Policy Number, etc. In the form footer I have a combo box for LastName which has 3 TEXT fields: LastName, FirstName & Policy...
2
by: Dwight | last post by:
Help ! Have a combo box in accsess, with 6 fields, I want each to show up a different colour when they ar selected/viewed. I have tried the following code but seems to have no affect can anyone...
4
by: MLH | last post by:
Somehow, I seem to be able to refer to combo-box controls in 2 distinctly different ways. A combo-box on an Access 97 form named TagCountyChooserBox seems can be referenced these ways... ...
2
by: Mark | last post by:
All, I have read the article on the MVP site regarding this topic (http://www.mvps.org/access/forms/frm0028.htm) but I am having some problems implementing it. I have a lookup table which...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
7
by: icenemesis | last post by:
Hello, I am using Access 2000. I have a combo box that is bound to a query that lists the status' from the following table. Status Table --------------------------------- id ...
1
patjones
by: patjones | last post by:
Hi all: I cannot figure this out for the life of me. I've got a combo box on my form called cboTitleCurrent. I set it's properties when the form opens as follows: With cboTitleCurrent ...
0
by: Bernadette Vandaele | last post by:
Hi, I am changing the background color of a combo box in a continuous form in Access 2007 with vba (... .backcolor = ...) from grey to white, but it doesn't work for all the lines in the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.