A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Text colour on a form



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2004, 07:47 PM
Box 666
external usenet poster
 
Posts: n/a
Default Text colour on a form

I have an unbound text box, with a simple Iif statement to give a "Yes" or
"No".

I would like this to stand out by having the text green for "yes" and red
for "no" - or if this is not possible can I change the background colour of
the text box as above.

How is the best way to achieve this.

Bob


  #2  
Old April 29th, 2004, 10:03 PM
fredg
external usenet poster
 
Posts: n/a
Default Text colour on a form

On Thu, 29 Apr 2004 18:47:23 GMT, Box 666 wrote:

I have an unbound text box, with a simple Iif statement to give a "Yes" or
"No".

I would like this to stand out by having the text green for "yes" and red
for "no" - or if this is not possible can I change the background colour of
the text box as above.

How is the best way to achieve this.

Bob


Depends upon which version of Access you have.
In Access 2000 or newer:
Click on the control.
Then format + Conditional formatting
Set the Condition1 Drop-down to
Field Value is
Then select Equal to in the box alongside.
In the box alongside write "Yes"
Select the Font color (and/or the BackColor) for when the condition is
met as well as when it is not met (the Default setting).

For Access 97, using single view form, this can also be done, but you
must use code.
Post back if that's what you need.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
  #3  
Old April 29th, 2004, 10:11 PM
Box 666
external usenet poster
 
Posts: n/a
Default Text colour on a form

Using 2000, but thank you for the offer.

Bob


"fredg" wrote in message
...
On Thu, 29 Apr 2004 18:47:23 GMT, Box 666 wrote:

I have an unbound text box, with a simple Iif statement to give a "Yes"

or
"No".

I would like this to stand out by having the text green for "yes" and

red
for "no" - or if this is not possible can I change the background colour

of
the text box as above.

How is the best way to achieve this.

Bob


Depends upon which version of Access you have.
In Access 2000 or newer:
Click on the control.
Then format + Conditional formatting
Set the Condition1 Drop-down to
Field Value is
Then select Equal to in the box alongside.
In the box alongside write "Yes"
Select the Font color (and/or the BackColor) for when the condition is
met as well as when it is not met (the Default setting).

For Access 97, using single view form, this can also be done, but you
must use code.
Post back if that's what you need.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.



  #4  
Old April 30th, 2004, 02:36 PM
Marin Kostov
external usenet poster
 
Posts: n/a
Default Text colour on a form

In the Change Event of the Text Box write the following code:

Private Sub txtAnswer_Change()
If txtAnswer.Text = "Yes" Then
txtAnswer.BackColor = vbGreen
ElseIf txtAnswer.Text = "No" Then
txtAnswer.BackColor = vbRed
Else
txtAnswer.BackColor = vbWhite
End If
End Sub

You might need to replace txtAnswer with the name of your text box.

--
Marin Kostov
Microsoft Office XP Master Instructor


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.