Date filters using combo box

samedi 21 mars 2015

Hi guys



I have a set of combo filters that filter one after the other as follows –




Private Sub cboCity_AfterUpdate()

If Nz(Me.cboCity.Text) = "" Then

Me.Form.Filter = ""

Me.FilterOn = False





ElseIf Me.cboCity.ListIndex <> -1 Then

Me.Form.Filter = Me.Form.Filter & " and [City] = '" & _

Replace(Me.cboCity.Text, "'", "''") & "'"

Me.FilterOn = True





Else

Me.Form.Filter = Me.Form.Filter & " and [City] = '" & _

Replace(Me.cboCity.Text, "'", "''") & "'"

Me.FilterOn = True

End If





Me.cboCity.SetFocus

Me.cboCity.SelStart = Len(Me.cboCity.Text)



End Sub



and so on to filter down so the user can work with what they filter, my question is how can I add on a filter that filters between dates? and second I was hoping that I could program the filters so that they could be changed individually/randomly as to filtering one after the other and then clearing to restart the filtering again if that makes sense.




I have tried using this, but it doesn’t work ‘Bad Command’



Me.Form.Filter=”StartDate =#” & Format(Me.txtStartDate, “mm/dd/yyyy”) & “#”

And

Me.Form.Filter=”EndDate =#” & Format(Me.txtEndDate, “mm/dd/yyyy”) & “#”





Cheers guys! :D

Date filters using combo box

0 commentaires:

Enregistrer un commentaire

Labels