Connecting Tech Pros Worldwide Forums | Help | Site Map

compile error:Method or data member not found

Newbie
 
Join Date: Sep 2008
Posts: 26
#1: Oct 1 '08
I have two combo boxes on my form, let's say box1(s1_individual_session) and box2(s1_nationality1), initially I disable box2(gray-out). I want to select box1 value is "true" then enable the box2,

the code:


Private Sub s1_individual_session_AfterUpdate()
If Me.s1_individual_session.Value = True Then
Me.s1_nationality1.Enabled = True
Else
Me.s1_nationality1.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's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,224
#2: Oct 1 '08

re: compile error:Method or data member not found


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:
Expand|Select|Wrap|Line Numbers
  1. Private Sub s1_individual_session_AfterUpdate()
  2. If Me.s1_individual_Session.Value = "<some value in the Combo Box>" Then
  3.   Me.s1_nationality1.Enabled = True
  4. Else
  5.   Me.s1_nationality1.Enabled = False
  6. End If
  7. End Sub
Reply