Enable CheckBox with ComboBox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tizzie
    New Member
    • Sep 2012
    • 3

    Enable CheckBox with ComboBox

    I need to enable a CheckBox(Jan) based on the selection of a ComboBox (Combo454) in Access 2010. The results I want is that when the answer of "Yes" is selected from the ComboBox then the CheckBox for the month of January will automatically be checked

    I've tried several code combination, the following being the last of many the still have not worked:

    Code:
    Private Sub Combo454_AfterUpdate()
    If Combo454.Value = True Then
    Jan.Enabled = True
    
    Else: Jan.Enabled = False
    End If
    Last edited by zmbd; Sep 6 '12, 10:17 PM. Reason: (z)placed required code tags
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    It depends on how you have in the row source for your combo box. If you just have the text "yes" and "no", then you would need the following code:
    Code:
    If Me.Combo454 = "Yes" Then
        Me.Jan = True
    Else
        Me.jan = False
    End If
    If you have a table complete with a primary key, then you would test on the PK value.

    Just curious, are you wanting to change the Enable property of the checkbox, or just whether it has a check mark? Your question leads me to believe the latter, but the code leads me to believe the former.

    Comment

    • tizzie
      New Member
      • Sep 2012
      • 3

      #3
      Thanks. Will give this a try. You are correct, I just want the box to reflect a check mark in it when the combobox answer is Yes.

      Comment

      • tizzie
        New Member
        • Sep 2012
        • 3

        #4
        Thanks so much. Worked like a charm.

        Comment

        • Seth Schrock
          Recognized Expert Specialist
          • Dec 2010
          • 2965

          #5
          Great! Glad I could help.

          Comment

          Working...