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

Triple State for Togglebutton not updating

Status
Not open for further replies.

BeallDon

Technical User
Aug 20, 2007
46
CA
I have a form with a toggle button - the triplestate property is YES. I am trying to perform different code for each state but it seems like the triplestate value is not updating on click.

This is the start of it all - i have left out other code to keep this simple. The fact remains that the there doesn't seem to be any change - the Caption does not change from True. Any suggestions would be welcome.


Private Sub CallReceived_Click()

Dim strTripleState As String

strTripleState = Me.CallReceived.TripleState

Select Case strTripleState
Case True
Me.CallReceived.Caption = "True"
Case False
Me.CallReceived.Caption = "False"
Case Else
Me.CallReceived.Caption = "Null"
End Select
End Sub

 
How are ya Jedody69 . . .

Take a really good look at the line in [purple]purple[/purple]:
Code:
[blue]Private Sub CallReceived_Click()

Dim strTripleState As String

[purple]strTripleState = Me.CallReceived[b].TripleState[/b][/purple]

Select Case strTripleState
    Case True
    Me.CallReceived.Caption = "True"
    Case False
    Me.CallReceived.Caption = "False"
    Case Else
    Me.CallReceived.Caption = "Null"
End Select
End Sub[/blue]


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

Be sure to see thread181-473997
Also faq181-2886
 
What about this ?
Code:
Private Sub CallReceived_Click()
With Me!CallReceived
  Select Case .Value
  Case True
    .Caption = "True"
  Case False
    .Caption = "False"
  Case Else
    .Caption = "Null"  'Can't happen as we're in the Click event
  End Select
End With
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Jedody69 . . .

In my 1st post, was hoping you would see that your looking at the [purple]TripleState[/purple] property, [blue]not the state of the button![/blue]

[blue]PHV[/blue] has shown a method to correct this.

Here's my version for full automation (includes opening of the form and a little clean up):
[ol][li]Copy/paste the following routine in the code module of the form:
Code:
[blue]Public Sub ToggleState()
   Dim ctl As Control, prp As Property
   
   Set ctl = Me!CallReceived
   Set prp = ctl.Properties("Caption")
   
   Select Case ctl
      Case True
         prp = "True!"
      Case False
         prp = "False!"
      Case Else
         prp = "Null!"
   End Select

   Set prp = Nothing
   Set ctl = Nothing

End Sub
[/blue]
[/li]
[li]Replace the code in the [blue]Click[/blue] event with the following:
Code:
[blue]   Call ToggleState[/blue]
[/li]
[li]Finally, copy/paste the same line above to the forms [blue]On Load[/blue] event.[/li][/ol]
[blue]Thats it! . . . Your Thoughts? . . .[/blue]

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

Be sure to see thread181-473997
Also faq181-2886
 
Thanks Aceman1,

Ya, upon further review, i noticed my error referring to the Triplesate PROPERTY, instead of VALUE of the button. Thanks for your help though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top