How do I check to see if a checkbox is checked or unchecked in Micross Access?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • insideedge
    New Member
    • Sep 2010
    • 1

    #1

    How do I check to see if a checkbox is checked or unchecked in Micross Access?

    I have a Microsoft Access form. On the form I have CheckBox controls in various groups. I would like to know how to communicate with a specific checkbox in a group to know if it's checked or unchecked.

    Thanks,

    Edge
  • munkee
    Contributor
    • Feb 2010
    • 374

    #2
    When you say grouped do you mean they are checkboxes within an option group control?

    Actually I remember seeing a tutorial which was quite good at explaining all this which I have found out again:

    http://www.datapigtechnologies.com/f...iongroups.html It shows you how to setup the control but also how to communicate to see which has been checked.

    Comment

    • reginaldmerritt
      New Member
      • Nov 2006
      • 201

      #3
      Each Check Box within a Option Group has a value. First Check box is 1, Second Check Box is 2 and so on

      To check the value of a Check Box within a Option Group

      Code:
      If Me.NameOfOptionBox = 1 Then 
      MsgBox("Check Box 1 = True")
      End If
      To check the value of a Check Box not in an Option Group

      Code:
      If Me.NameOfCheckBox = True Then
      MsgBox("Check Box = True")
      End If
      Reg

      Comment

      • munkee
        Contributor
        • Feb 2010
        • 374

        #4
        I would use select case for a set of checkboxes in an option group it just looks a lot cleaner than using if statements.

        E.g.

        Code:
        Select case me.optiongroupname
        
        Case 1 
        msgbox "1 selected"
        Case 2
        msgbox "2 selected"
        Case 3
        msgbox "3 selected"
        Case else
        msgbox "no selection made"
        End select

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32669

          #5
          You can always refer to a CheckBox control on a form by its name.

          If it is within an Option Group you have another alternative. To see the currently selected CheckBox you can also check the value of the OptionGroup control itself. Remember though, CheckBoxes within OptionGroups behave like RadioButtons rather than normal CheckBoxes, in as much as only one may be selected at any one time.

          This can be confusing to operators so should be used very carefully.

          Comment

          Working...