Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Colour change dependant on Yes/No field 1

Status
Not open for further replies.

simonjackson79

Technical User
Dec 23, 2003
31
0
0
GB
Hi,

I'm having a problem with a form control. I am creating a database that deals with sensitive information. On the client record screen which only displays information i need to use a control that changes colour dependant on the answer of a yes/no field. The field cannot actually display the y/n answer but need to be green if no and red if yes. Is this possible with access, or have I got no chance?

Simon
 
Hi, this can be done a number of ways. What I would do is, assuming you have a text box on your form that is bound to the Yes/No field in your table, use the following code in the forms OnCurrent event:

If Me.yourtextboxname = -1 Then
Me.yourtextboxname.Backcolor = vbRed
Me.yourtextboxname.Forecolor = vbRed
Else
Me.yourtextboxname.Backcolor = vbGreen
Me.yourtextboxname.Forecolor = Green
End If

Change text box name to suit.

This will make both the box and the text green or red, making the answer invisible to the user

Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
Your are an absolute star, so I think I'll award you one!! Thank you very, very, very muchly.

Si
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top