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
Err_Select_Click:
MsgBox Err.Number
Exit Sub
End Sub
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
Err_Select_Click:
MsgBox Err.Number
Exit Sub
End Sub