05-08-12, 18:49 #1Registered User
- Join Date
- Apr 2012
Unanswered: Command button to clear checked combo box
I was hoping someone would be able to tell me what the code is if I want to program a command button to clear the check mark made in a combo box. Basically we want a way to clear that field if it was checked incorrectly.
Also, if anyone has time, how can I make multiple check boxes that are bound to a single field? I want to basically have a combo box structure where more than one box can be checked it it applies.
Thanks in advance!
05-08-12, 19:32 #2Moderator
Provided Answers: 14
- Join Date
- Mar 2009
If a Checkbox was "checked", you only need to click again on it to "uncheck" it. There is no need for a button to accomplish this task.
Now if you mean that you want to revert the checkbox to it's "greyed" state (nor checked, nor unchecked), which represents a Null value in the data field it is bound to, you can use:
Private Sub Command_Reset_Click() Me.Check0.Value = Null End Sub
I don't understand why you would want to have several controls (checkbox or any other type of control) bound to the same data field. Even if you can bind several checkbox controls to a single boolean data field (see above), all these controls will change simultaneously when the value of the data field changes (this is precisely the meaning of binding a control to a data field). You cannot expect the same value to be True in a checkbox and False in another one.Have a nice day!
05-08-12, 23:42 #3Moderator
Provided Answers: 19
- Join Date
- Jun 2005
- Richmond, Virginia USA
I think the OP is talking about a Combobox that is populated with the Values from one of the new (in versions 2007/2010) Multi-valued fields. When used in a Combobox, I understand that they include a Checkbox, allowing for multiple selections to be selected in the Combobox by placing a tick by each one.
Having no interest in this horrid new feature, I know really nothing else about them. If the object here is to de-select a single mistake, I'd think that you could, indeed, simply untick it. If you're trying to de-select all of the ticked selections, you could try doing a Requery of the Combobox.
Linq ;0)>Hope this helps!
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007
05-17-12, 11:48 #4Registered User
- Join Date
- May 2012
I managed to get this working using the following awful code:
On Error Resume Next Dim a(1) a(0) = Null Me.cbo1.Value = a Me.cbo1 = Null Me.cbo1.Requery Err.Clear
BTW, missinglinq, I think combo boxes with checkboxes are a great idea. They really increase usability. Now, I do have some major complaints with the way M$ implemented this feature in MS Access. In my opinion, with the current implementation, the only place that one should use this option is for filtering since the actual stored values will then be of no concern then. The table you bind to will basically be a single record, dummy table in the front end (or could be an Access linked table as well) and will never need to be upsized to SQL server.
I made up an example which I plan to post over at UA when I get time along with some outstanding questions. I'd really like to find a way to allow a user to type in the combo, which is not an option. So I'm trying to dream up creative ways of working around this problem, mostly likely by using two or three controls that work together with each other to achieve the desired affect.