Toggle YES/NO state HELP .......pse

johnhobbis

Registered User.
Local time
Today, 00:32
Joined
Apr 5, 2001
Messages
22
Hi I am trying to toggle a Yes/No state, so that Yes has text "AT RISK" on the toggle and NO has "NOT AT RISK" text

I have done this Expression: which looks at the state and show a box when YES and disappears when NO:


Private Sub At_Risk_Register_Click()
If Me.At_Risk_Register.Value = True Then
Me.ATRISK.Visible = True
Else
Me.ATRISK.Visible = False
End If

End Sub

But, Need it to work of the Toggle itself.

Thanks for that little Pearl........

Only Problem is that when I go back to the record the button is blank and doesnt display the AT RISK or NOT AT RISK ? and the each record in the form has the same state AT RISK or NOT AT RISK

Do you Know how you can change the background colour of a button.??




[This message has been edited by johnhobbis (edited 04-11-2001).]
 
I did something very similar just last week. I did it by setting the caption property with the 'AfterUpdate' event. I used 'AfterUpdate' in case the user uses tab and the space bar to activate the toggle. Anyway here's the code that should do what you're looking for.

Private Sub At_Risk_Register_AfterUpdate()
If Me.At_Risk_Register.Value = True Then
Me.At_Risk_Register.Caption = "AT RISK"
Else
Me.At_Risk_Register.Caption = "NOT AT RISK"
End If
End Sub

Hope this helps.

~Abby

[This message has been edited by Abby N (edited 04-11-2001).]
 
Thanks for that little Pearl........

Only Problem is that when I go back to the record the button is blank and doesnt display the AT RISK or NOT AT RISK ? and the each record in the form has the same state AT RISK or NOT AT RISK

Do you Know how you can change the background colour of a button.??
 
Abby that would be great.....

Thank you.

john@hobbis.karoo.co.uk

Thank you..... Regards
John
 
I deleted my last post because I misread your response and the information it contained wasn't really of much value and could lead to some confusion. Anyway, if you code the forms 'OnLoad' event with the same code you used in the 'AfterUpdate' of the control that will take care of the vanishing caption.

However, you'd mentioned that it wasn't changing state as you flipped through records. Is there a field in your source that would indicate what state the toggle should be in?

As to the background color. That can get rather tricky. I'm emailing you a DB with some examples.

~Abby
 

Users who are viewing this thread

Back
Top Bottom