Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Set checkbox to 'undetermined' (2000)

    Is there a way of setting a checkbox, or its bound yes/no field, to a state that is neither on nor off?

    I am trying to emulate the behaviour of the built in filter by form functionality and my approach (so far) is to set the recordsource of the form that will be used to enter the filter criteria to a table with a single empty record, then, once the user has made the required selections, use the values of the fields in this record to create a filter string. I've started doing things this way because I want the users to be able to swap between a single record view and a list view, both of which will use the filter that the user has created. Using the built in filter by form functionality things work fine until the filter involves selections from dropdown boxes. At this point the filter string is not transportable from one form to another as it contains weird looking terms that I assume have been devised specifically for the use of the built in filter by form (of the form Lookup_ControlName.TextFieldName = "xyz").

    I think I can see a lot of benefits with this alternative table based approach. Specifically it will be simple to save the filters and allow them to be edited later

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Set checkbox to 'undetermined' (2000)

    I believe your issue is with the default value being assigned in the table - it appears it is probably set to No. Change it to Null and see if that helps.
    Wendell

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Set checkbox to 'undetermined' (2000)

    A Yes/No field in a table and a check box on a form bound to a Yes/No field can not have three states, since a Yes/No field is either Yes or No, not Null. If you want a bound check box with three states, you must bind it to a number field and set its Triple State property to Yes. The possible values of the number field will be Null, 0 and -1.

  4. #4
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set checkbox to 'undetermined' (2000)

    That looks to be just what I'm looking for. However, I have a problem. I have changed the underlying table so that the check boxes are bound to numeric fields (long integer) and changed the form so that the Triple State property of the check boxes is set to Yes. Existing data displays OK but when I click on a checkbox I get a 'The value you entered isn't valid for this field error'.

    Ian

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Set checkbox to 'undetermined' (2000)

    Check the table; the numeric values should be either -1 (True), 0 (False) or blank (null)

    I have attached my test database with a triple state check box bound to a number field. It works for me.
    Attached Files Attached Files

  6. #6
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set checkbox to 'undetermined' (2000)

    Oops. Very sorry. I changed the data types in the wrong table. It now works perfectly.
    (is there one of those smiley things for embarrassed?)

    Ian

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Set checkbox to 'undetermined' (2000)

    We have <!t>[blush]<!/t> <img src=/S/blush.gif border=0 alt=blush width=15 height=15>

Posting Permissions

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