473,394 Members | 1,081 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,394 software developers and data experts.

conditional formatting of textbox

Thanks in advance... I have a continuous style form with a field for
each record called "STATUS". I simply want to have the form load and
if the value of the textbox is "Inactive" I want the textbox
background to display yellow, else I want it to be just white. Here's
my code... but it is not working

Private Sub Form_Load()
If Me!STATUS = "Inactive" Then
Me!STATUS.BackColor = RGB(255, 255, 0)
Else
Me!STATUS.BackColor = RGB(255, 255, 255)
End If
End Sub
'Thanks!

May 29 '07 #1
4 8905
On May 29, 1:48 pm, slinky <campbellbrian2...@yahoo.comwrote:
Thanks in advance... I have a continuous style form with a field for
each record called "STATUS". I simply want to have the form load and
if the value of the textbox is "Inactive" I want the textbox
background to display yellow, else I want it to be just white. Here's
my code... but it is not working

Private Sub Form_Load()
If Me!STATUS = "Inactive" Then
Me!STATUS.BackColor = RGB(255, 255, 0)
Else
Me!STATUS.BackColor = RGB(255, 255, 255)
End If
End Sub

'Thanks!
http://www.mvps.org/access/forms/frm0047.htm

May 29 '07 #2
On 29 May 2007 10:48:33 -0700, slinky wrote:
Thanks in advance... I have a continuous style form with a field for
each record called "STATUS". I simply want to have the form load and
if the value of the textbox is "Inactive" I want the textbox
background to display yellow, else I want it to be just white. Here's
my code... but it is not working

Private Sub Form_Load()
If Me!STATUS = "Inactive" Then
Me!STATUS.BackColor = RGB(255, 255, 0)
Else
Me!STATUS.BackColor = RGB(255, 255, 255)
End If
End Sub

'Thanks!
Use Conditional formatting (Access 2000 or newer).
In Form Design view, right-click on the [Status] control and select
Conditional formatting.
Set the Condition1 drop-down to Field Value Is.
Select "equal to" in the next drop-down box
Write "Inactive"
in the next box.
Select the BackColor.
Save the changes.

Note: the above assumes the datatype of the [Status] control is Text.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
May 29 '07 #3
On May 29, 11:04 pm, fredg <fgutk...@example.invalidwrote:
On 29 May 2007 10:48:33 -0700, slinky wrote:
Thanks in advance... I have a continuous style form with a field for
each record called "STATUS". I simply want to have the form load and
if the value of the textbox is "Inactive" I want the textbox
background to display yellow, else I want it to be just white. Here's
my code... but it is not working
Private Sub Form_Load()
If Me!STATUS = "Inactive" Then
Me!STATUS.BackColor = RGB(255, 255, 0)
Else
Me!STATUS.BackColor = RGB(255, 255, 255)
End If
End Sub
'Thanks!

Use Conditional formatting (Access 2000 or newer).
In Form Design view, right-click on the [Status] control and select
Conditional formatting.
Set the Condition1 drop-down to Field Value Is.
Select "equal to" in the next drop-down box
Write "Inactive"
in the next box.
Select the BackColor.
Save the changes.

Note: the above assumes the datatype of the [Status] control is Text.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Hi Fred,

Any idea why this does not work for multi-valued combo box? i.e. if
above formating is used, it works only if that single value is
selected. If multiple values are selected with that value, it does not
work.

May 30 '07 #4
On 29 May 2007 22:48:09 -0700, Matuag wrote:
On May 29, 11:04 pm, fredg <fgutk...@example.invalidwrote:
>On 29 May 2007 10:48:33 -0700, slinky wrote:
>>Thanks in advance... I have a continuous style form with a field for
each record called "STATUS". I simply want to have the form load and
if the value of the textbox is "Inactive" I want the textbox
background to display yellow, else I want it to be just white. Here's
my code... but it is not working
>>Private Sub Form_Load()
If Me!STATUS = "Inactive" Then
Me!STATUS.BackColor = RGB(255, 255, 0)
Else
Me!STATUS.BackColor = RGB(255, 255, 255)
End If
End Sub
>>'Thanks!

Use Conditional formatting (Access 2000 or newer).
In Form Design view, right-click on the [Status] control and select
Conditional formatting.
Set the Condition1 drop-down to Field Value Is.
Select "equal to" in the next drop-down box
Write "Inactive"
in the next box.
Select the BackColor.
Save the changes.

Note: the above assumes the datatype of the [Status] control is Text.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Hi Fred,

Any idea why this does not work for multi-valued combo box? i.e. if
above formating is used, it works only if that single value is
selected. If multiple values are selected with that value, it does not
work.
1) A combo Box cannot contain multiple values. Perhaps you meant to
say a List Box.

2) Well if you select "x" and "y" and "z" in a list box, then it's
value is xyz, not just x.

3) To work with a multi-select list box you'll need to use code to
cycle through the selections and do something with them. There is
sample code in VBA help to do this.

4) Why didn't you state, in your original post, that it was a
multi-select list box?


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
May 30 '07 #5

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

Similar topics

1
by: GGerard | last post by:
Hello Is there a way to use a variable in the Conditional Formatting of a Textbox? Example : I want the background of a textbox in a continuous form to change color when the value of...
2
by: jodyblau | last post by:
I'm not certain that what I am trying to do is possible; in any event I haven't been able to figure it out. Here is what I am trying to do: I have one table that has a list of cases I'm working...
5
by: jodyblau | last post by:
I am trying to do some conditional formatting with a textbox and I am not able to quite get it. Here is the setup: My record includes a textbox called and two checkboxes the first called ...
8
by: Typehigh | last post by:
I have many text fields with conditional formatting applied, specifically when the condition is "Field Has Focus". Without any events associated with the fields the conditional formatting works...
2
by: Lyn | last post by:
Hi, Having fun trying to get Conditional Formatting working on a textbox control in a continuous form subform (Access 2003). The condition I want is when the value of the textbox is Null and/or...
10
by: Lyn | last post by:
Hi, I would like to make a bound text box not visible if it is empty (not just disable it). This option is not available from the standard conditional formatting feature (at least, not that I can...
2
by: robertng90025 | last post by:
I'm having a problem with MS Access 2003 and its conditional formatting. I have textboxes on a continuous form whose left and right margins are set to 0.03 inches. Based on each textbox's...
1
by: Earl Anderson | last post by:
A business colleague and I are collaborating 'long distance' on an applet for work. He is doing the programming and I am doing the business process form design. We had discussed my desire to make...
1
by: Greg (codepug | last post by:
Access 2000 Using a textbox of a single form, I created a calculated field. The following code is in the Control Source for this field: =IIf(=24,+(/),/ ) The numbers that are calculated are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.