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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Background Color change in field #2 when I click on Yes/No field #1

Status
Not open for further replies.

molly

Technical User
Jul 17, 2000
219
US
I have an event on the main form. I would like the AccountID (field #2) background / fore colors to change whenever i click on the CheckActive (field #1) name field. Presently, this all works fine if i go to the next record and return back.
I would like to see the AccountID field colors to immediately change when i click on the yes/no field named CheckActive. Can do? Thanks Molly


----------------------------------------------
Private Sub Form_Current()

If CheckActive = True Then
AccountID.BackColor = 16777215 'white
AccountID.ForeColor = 16711680 'blue
Else
AccountID.BackColor = 255 'Red
AccountID.ForeColor = 16777215 'white
End If

End Sub
------------------------------------------
 

In addition to your current code, add this:

Code:
Private Sub CheckActive_AfterUpdate()
 If CheckActive = True Then
        AccountID.BackColor = 16777215 'white
        AccountID.ForeColor = 16711680 'blue
    Else
        AccountID.BackColor = 255 'Red
        AccountID.ForeColor = 16777215 'white
    End If
End Sub

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
How are ya molly . . .

I believe you'll find [blue]Conditional Formatting[/blue] more appropriate for your needs (Assuming [blue]CheckActive[/blue] is a bound control).

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
I've been debating if I should make the bound field CheckActive as a yes/NO field or a plain Text field. What do you think?

I have the AccountID field and CheckActive changing it's colors when i change the N or Y in checkActive field.

However, the color does not change on the present record if i change the CheckActive field. I need to go to the next record and then go backwards to the previous record. And then all is fine.

So I am close. I do not know what Aceman means. Can you elaborate? Thanks alot. Molly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top