The question I'd like to ask here is actually very simple. So I'll put the question first and just in case the full context is underneath it. Thanks!
THE QUESTION:
I want to set a checkbox value from the OnSelect of a button. I thought I could do it by entering the following to the OnSelect formula of the button:
cbx_AssignedToMe.Value = false
Entering this formula does not result in any error. But, alas, life is not this simple and when I press the button nothing happens.
I've searched around and this question always seems to get answered by explaining about the default value. But I don't think that applies to my scenario. I want to clear the checkbox programatically. How can I do it?
THE CONTEXT:
I have built a filter screen with a bunch of different data filters that can be set. On this screen are two checkboxes which act as simple helpers to set up two of the filters to the current user. In the grab below, you can see that because I set the "Assigned to me" checkbox, the associated Assigned to: textbox got disabled and the user was automatically assigned to me.
At the bottom of the screen I have a clear filters button which has the job of resetting all the filters. As part of this, I want to clear the checkboxes back to false.
The filters themselves are easy to clear as I have them set up as variables and I can just use the Set(variable, value) method to do it. This does result in all my filters being cleared. But unfortunatley the checkboxes (if checked) stay checked and I need to clear them programatically.
It's (more than) a little late now but this should work for setting off if it's on...
If(cbx_AssignedToMe.Value, Select(cbx_AssignedToMe));
Thank you - I was able to adapt your solution to suit my scenario. In my scenario I am only concerned with clearing the checkbox via a button, never checking them. So the approach is different but the basis of your solution is sound and I've got it working.
It does seem like a total 'round the houses' way to do something that I feel should be very simple. I think I should be able to assign the checkbox value directly.
But there you go, it is what it is and it's working - thanks again.
This is an example that will show you how to do this, not coded for your exact situation.
In my example a single button sets both check and uncheck status, in yours you can split this between two buttons.
Code for onselect of the button is.
If(checkVar=true,
Set(checkVar,false),
Set(checkVar,true))
Then you set the Default code of your checkbox to
checkVar
as checkVar is cycled between true and false by onselects the checkbox will check and uncheck itself
WarrenBelz
146,743
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,079
Most Valuable Professional