Results 1 to 4 of 4
  1. #1
    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!

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    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
    About your second question, a bound checkbox is used to represent the value of a boolean data field (Yes/No (Null) or True/False (Null), etc.); to a certain extend and through implicit conversions, it can represent any numeric value where 0 = Unchecked (False) and any other value = Checked (True) while Null (which is not a value) = Greyed.

    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!

  3. #3
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    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 that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    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
    I couldn't find any way to avoid the error messages so I just chose to ignore them.

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts