conditional formatting of textbox 
May 29th, 2007, 06:55 PM
| | | |
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 29th, 2007, 07:05 PM
| | | | re: conditional formatting of textbox
On May 29, 1:48 pm, slinky <campbellbrian2...@yahoo.comwrote: Quote:
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 29th, 2007, 07:05 PM
| | | | re: conditional formatting of textbox
On 29 May 2007 10:48:33 -0700, slinky wrote: Quote:
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 30th, 2007, 06:55 AM
| | | | re: conditional formatting of textbox
On May 29, 11:04 pm, fredg <fgutk...@example.invalidwrote: Quote:
On 29 May 2007 10:48:33 -0700, slinky wrote:
> Quote:
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
| > Quote:
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
| >>
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 30th, 2007, 05:25 PM
| | | | re: conditional formatting of textbox
On 29 May 2007 22:48:09 -0700, Matuag wrote: Quote:
On May 29, 11:04 pm, fredg <fgutk...@example.invalidwrote: Quote:
>On 29 May 2007 10:48:33 -0700, slinky wrote:
>> Quote:
>>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
| >> Quote:
>>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
| >>>>
>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 |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,698 network members.
|