Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004

    Unanswered: Assigning Numeric Values to Yes/No Boxes


    im having trouble assigning a number values to different checkboxes.

    I have 12 of them an each one has a different number if they are checked

    lets say
    Table.CheckBox1 = Yes = 1
    Table.CheckBox2 = Yes = 2

    I also have to then concatenate the values of all the checkboxes = yes in this format onto another field

    1,2,3,6,8,99. etc

    If any one has any suggestions, please let me know


  2. #2
    Join Date
    Apr 2004
    outside the rim
    A straight Yes/No (which a Check Box is) is either -1 (Yes) or 0 (No).

    Even if you assign a "Default Value" to a check box, once it has been checked, or unchecked, the value reverts to -1 or 0.

    If you use a hidden control with an "immediate if", you can effectively accomplish the task and it will look right to the user.

    The hidden control determines the value when the check box is checked.

    For example, if Check7 is the check box I want to equal 7, then I'll have a hidden text box with the following statement as the control source:

    When the check box is checked, the text box has the value of 7. When it's not checked, the text box is empty.

    As for concatenating the values, your best bet is to use a function in code

    If you use Text1, Text2, Text3, etc. for your text box names, you can use a loop to rifle through all the text boxes in only a few lines of (in straight Visual Basic, it's even easier, because VB allows you to index your controls).

    Have fun

Posting Permissions

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