You're missing the quote marks. "YES" is a string, whereas YES is an undefined variable, so empty. Using your existing code, this would work:
Private Sub Togglebutton1_Click()
If ToggleButton1.Caption = "YES" Then
ToggleButton1.Caption = "NO"
ToggleButton1.Value = False
Else
ToggleButton1.Caption = "YES"
ToggleButton1.Value = True
End If
End Sub
But this would be more efficient:
Private Sub Togglebutton1_Click()
If ToggleButton1.Value Then
ToggleButton1.Caption = "YES"
Else
ToggleButton1.Caption = "NO"
End If
End Sub
HTH
Tim
Bookmarks