Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2007

    Unanswered: Using a filtered/cascaded combobox

    Okay, I'm nearly done now.

    I have a form with two comboboxes.
    The first cboCoursetype filters the second combox cboQualLevel

    The comboboxes are set up to store the information in an underlying table (it is a data entry form).
    When the form is first opened, the second box cboQualLevel displays the correct choices of level. e.g. If the Coursetype is University/College the list is
    A level or equivalent
    First degree
    Other undergraduate

    The problem is that if you choose say "First degree" the option pops back to A level or equivalent.
    If you leave it at this and finish the record and save it and exit and then go back to it you are able to select the correct option e.g. "First degree"

    Any hints about what is going wrong here?

    Private Sub cboCourseType_AfterUpdate()
    Dim sQuallevel As String
        sQuallevel = "SELECT [Quallevel].[Coursetypefk]," & _
                       " [Quallevel].[Quallevel]," & _
                       " [Quallevel].[Quallevelid] " & _
                         "FROM Quallevel " & _
                         "WHERE [Coursetypefk] = " & Me.cboCourseType.Value
        Me.CboQualLevel.RowSource = sQuallevel
    End Sub

  2. #2
    Join Date
    Oct 2004
    Melbourne, Australia
    Because of the way MS Access opens up forms and sets up its objects, you sometimes start off with a badly defined cross-reference between cascaded combo baxes. This might be the case, because everything works OK second time around. You might try setting the first combo box to a default (e.g. A level) and do a filter set and requery on the econd combo box, all in the Form_Open() event.

  3. #3
    Join Date
    Jul 2007
    Thanks Jim,
    That sounds like what I need to do.
    I am unsure how to correctly code the filter set and requery on the combo box cboQualLevel from the Form_Open() event rather than set the filter on the entire form?

  4. #4
    Join Date
    Jul 2007
    When I apply a filter to the Form_Open event it stops the already existing filter on that form. Is there something else I could try?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts