Results 1 to 3 of 3
  1. #1
    davidadowns is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2016
    Location
    georgia
    Posts
    1

    Question cannot limit 3rd cascding combo box

    selection in cboSkillSet limits cboSubSkills. But selection in cboSubSkills will not limit cboSubSkills2. Entire tblsubSkills2 is returned in cboSubSkills2 box, Any item can be selected and written to the table I need it in, But I can't limit it to the selection in the SubSkill2 box



    Private Sub cboSkillList_AfterUpdate()
    With Me![cboSubSkillList]
    If IsNull(Me!cboSkillList) Then
    .RowSource = ""
    Else
    .RowSource = "SELECT [SubSkill] " & _
    "FROM SubSkillList " & _
    "WHERE [SkillID]=" & Me!cboSkillList
    End If
    Call .Requery
    End With

    End Sub


    Private Sub cbosubSkillList_AfterUpdate()
    With Me![cboSubSkillList2]
    If IsNull(Me!cboSubSkillList2) Then
    .RowSource = ""


    Else
    .RowSource = "SELECT [SubSkill2] " & _
    "FROM SubSkillList2 " & _
    "WHERE [subSkillID]=" & Me!cboSubSkillList **(have also tried adding ![SubSkillID] here)**

    End If
    Call .Requery
    End With

    End Sub

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by davidadowns View Post
    ...But selection in cboSubSkills will not limit cboSubSkills2...
    I do not see an event handler for cboSubSkills. It sounds like you need to add an afterupdate event for cboSubSkills and include a WHERE clause (that considers the value cboSubSkills) to the RowSource of cboSubSkills2.

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Code:
    Private Sub cbosubSkillList_AfterUpdate()
        With Me![cboSubSkillList2]
             If IsNull(Me!cboSubSkillList2) Then
              .RowSource = ""
            Else
                 .RowSource = "SELECT [SubSkill2] " & _
                                "FROM SubSkillList2 " & _
                                "WHERE [subSkillID]=" & Me!cboSubSkillList   **(have also tried adding ![SubSkillID] here)**
    
             End If
          .Requery
        End With
    
     End Sub
    You are checking the wrong combo box in the red highlight - it should be Me!cboSubSkillList (without the "2"), because it's the selection in that combo that determines the list in cboSubSkillList2.
    Last edited by John_G; 08-15-2016 at 10:27 AM. Reason: fix typo and add code delimiters

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 03-22-2016, 09:56 PM
  2. Replies: 8
    Last Post: 06-23-2014, 12:19 PM
  3. combo box/subform limit
    By kris9 in forum Forms
    Replies: 7
    Last Post: 06-20-2013, 12:22 AM
  4. Limit Combo box records
    By BFlat in forum Forms
    Replies: 9
    Last Post: 01-26-2013, 05:48 PM
  5. Replies: 1
    Last Post: 08-26-2009, 10:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums