Results 1 to 2 of 2

Thread: listbox filter

  1. #1
    Join Date
    Jun 2002

    Unanswered: listbox filter

    I have a listbox that displays data according to a selection from a combobox. Now I want the user to be able to make a selection in the listbox and then a subform filters it's records accordingly. Suggestions? This is what i wrote, but it is obviously wrong.

    Private Sub lstResults_Click()
    On Error GoTo Err_Select_Click
    Dim i As Integer
    '12 months
    i = 0
    For i = 0 To 11
    If lstResults.Selected(i) = True Then
    Me.Day_subform.Form.Filter = "MIndex = lstResults.column(0)"
    Me.FilterOn = True
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70
    End If
    Next i
    MsgBox Err.Number
    Exit Sub
    End Sub

  2. #2
    Join Date
    Nov 2002
    The Netherlands
    I use this to get the right values in my subform

    strSQL = "select * from YourTable where YourTable.[FieldName]= '" & Me.lstResult.Column(0) & "'"
    Me.Day_subform.Form.RecordSource = strSQL

    By the way is this a multiselect Listbox???

Posting Permissions

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