Connecting Tech Pros Worldwide Help | Site Map

conditional formatting of textbox

 
LinkBack Thread Tools Search this Thread
  #1  
Old May 29th, 2007, 05:55 PM
slinky
Guest
 
Posts: n/a
Default 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!


  #2  
Old May 29th, 2007, 06:05 PM
DavidB
Guest
 
Posts: n/a
Default 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

  #3  
Old May 29th, 2007, 06:05 PM
fredg
Guest
 
Posts: n/a
Default 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
  #4  
Old May 30th, 2007, 05:55 AM
Matuag
Guest
 
Posts: n/a
Default 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
>
Quote:
'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.

  #5  
Old May 30th, 2007, 04:25 PM
fredg
Guest
 
Posts: n/a
Default 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
>>
Quote:
>>'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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

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 220,840 network members.