Multiple checkboxes on the form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tomeczek
    New Member
    • Feb 2008
    • 3

    Multiple checkboxes on the form

    I'm building the application using Access 2007.
    I have four checkboxes on my form. Checking off different checkboxes will control the VBA routines "behind" the button.

    I realized, that during the execution of the form, my four checkboxes behave like "radio buttons": only one checkbox can be checked off, checking second box cleares the first one. Am I doing something wrong? Missing something?

    Also: how do I read the status of the box? There is no "value" property (as in VB6).

    Thank you in advance for your advice!
  • maxvernon
    New Member
    • Feb 2008
    • 12

    #2
    you most likely placed the checkboxes inside a Frame in order to group them together logically. You really want to place them inside a Rectangle, not a frame. The Frame will allow only a single checkbox to be "checked" whereas the Rectangle will allow any, all, or none of the checkboxes to be checked at the same time.

    Comment

    • Tomeczek
      New Member
      • Feb 2008
      • 3

      #3
      Thanks, maxvernon. That was it!

      Now: how can I set initial values on checkboxes and option (radio) buttons using VBA? There is no "value" property...

      Comment

      • mshmyob
        Recognized Expert Contributor
        • Jan 2008
        • 903

        #4
        For a CheckBox control just do it like this. Replace 'chkControl' with your checkbox control name

        [CODE=vb]
        ' check for FALSE means NOT CHECKED
        If Me.chkControl = False Then
        'do something here
        Else
        'do something else
        End If
        [/CODE]

        Cheers,

        Originally posted by Tomeczek
        Thanks, maxvernon. That was it!

        Now: how can I set initial values on checkboxes and option (radio) buttons using VBA? There is no "value" property...

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          Mshmyob's code does set the checkbox's .Value property! Why did you think it didn't have one?

          Welcome to TheScripts!

          Linq ;0)>

          Comment

          • Tomeczek
            New Member
            • Feb 2008
            • 3

            #6
            Originally posted by missinglinq
            Mshmyob's code does set the checkbox's .Value property! Why did you think it didn't have one?

            Welcome to TheScripts!

            Linq ;0)>
            Great place! So much information here! And help, too.

            You're right, it's there, but not shown in the Property Sheet.

            Thanks !

            Comment

            Working...