I need to use a CheckBox to toggle a condition ON or OFF.
The problem is that when I have established whether the CheckBox was ticked or not on entry into it's 'On Click' event I then need to toggle it the other way.
I am doing this by CheckBox.Value=vbChecked (if it was previously UnChecked) and CheckBox.Value=vbUnChecked (if it was previously Checked).
The problem I have is that by doing this the On_Click event is firing again.
I have found a way around this by setting a boolean variable to establish whether the On_Click event has been fired by the user or the code described above.
This works but is is not very elegant.
Are there any better ways to handle this?
Can the events be turned on and off as this would be one solution?
Any tips appreciated.
Regards
The problem is that when I have established whether the CheckBox was ticked or not on entry into it's 'On Click' event I then need to toggle it the other way.
I am doing this by CheckBox.Value=vbChecked (if it was previously UnChecked) and CheckBox.Value=vbUnChecked (if it was previously Checked).
The problem I have is that by doing this the On_Click event is firing again.
I have found a way around this by setting a boolean variable to establish whether the On_Click event has been fired by the user or the code described above.
This works but is is not very elegant.
Are there any better ways to handle this?
Can the events be turned on and off as this would be one solution?
Any tips appreciated.
Regards