compile error:Method or data member not found

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jayjayplane
    New Member
    • Sep 2008
    • 26

    compile error:Method or data member not found

    I have two combo boxes on my form, let's say box1(s1_individ ual_session) and box2(s1_nationa lity1), initially I disable box2(gray-out). I want to select box1 value is "true" then enable the box2,

    the code:


    Private Sub s1_individual_s ession_AfterUpd ate()
    If Me.s1_individua l_session.Value = True Then
    Me.s1_nationali ty1.Enabled = True
    Else
    Me.s1_nationali ty1.Enabled = False
    End If
    End Sub



    but it gave me compile error:Method or data member not found, I don't know what caused the problem, I started my current project without any knowledge of Access programming. thanks.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    The problem is, that once an item is selected in a Combo Box, its value doesn't return True or False, but the Name of the item selected:
    Code:
    Private Sub s1_individual_session_AfterUpdate()
    If Me.s1_individual_Session.Value = "<some value in the Combo Box>" Then
      Me.s1_nationality1.Enabled = True
    Else
      Me.s1_nationality1.Enabled = False
    End If
    End Sub

    Comment

    Working...