in my app, i've got a check box placed on a command button. the command button displays/hides a large text box used for entering/editing client notes. if there are already notes, the check box is checked, if the notes are empty, there will be no check

all of this works fine, but I want to stop the check box from being changed when it's clicked on. i came up with the following sub: -

Public Sub CheckBoxClick(Ctrl As Control)
'stop a check box responding to being clicked on
With Ctrl
If .Value = 1 Then
.Value = 0
Else
.Value = 1
End If
End With
End Sub

and in the click event of the check box, i put : -

Private Sub chk_Notes_Click()
CheckBoxClick chk_Notes
End Sub

the reason i did it this way is that i have lots of occasions where i have check boxes used simply as indicators

the only problem being when i call the sub, i get runtime error 28 - out of stack space. the only reason i can think of is that when i set the value of the check box, the click event is being called ad infinitum.

i've tried disabling the check box, but they look horrible then.
what's the best way of doing this - it doesnt have to be a check box on the button, as long as it looks obvious that there are or are not notes to be viewed.


[Edited by Jimbob on 07-14-2000 at 06:15 AM]