Filtering dates

Neilster

Registered User.
Local time
Today, 04:28
Joined
Jan 19, 2014
Messages
218
Hi

Can I use the below method to filter dates from and to, I have comboboxes that filter one after the other using the afterupdate even??

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
 
Cheers, would really appreciate it if you could as I have tried numerous other ways.

:D:D
 
Post your DB with some simple data (Access version 2007 or 2003)
Note please that ElseIf statement is harder to manage than the IF-THEN-ELSE.
 
The company I work for would not allow me to post the DB. Thanks anyway
 
The company I work for would not allow me to post the DB. Thanks anyway
Again and again AND again the same problem.
I (we) ask about the DB NOT about the DB WITH data.
 

Users who are viewing this thread

Back
Top Bottom