Filter form by date

  • Thread starter Thread starter Phil Pereira
  • Start date Start date
P

Phil Pereira

I have an unbound text box with a date in it. I want to filter my form
to only show dates that match this unbound box's value. I have tried to
use this:

mydate = TxtDateSelect.Text
Me.Filter = "DateEntered = " & mydate
Me.FilterOn = True

But this results in no data. I'm pretty sure I'm formatting the filter,
but I'm not sure what to do about it.

Any help would be appreciated.

Thanks,

Phil
 
Phil Pereira wrote:

What I meant to say was, I'm pretty sure I'm formatting the filter
incorrectly...
 
Phil Pereira wrote:

What I meant to say was, I'm pretty sure I'm formatting the filter
incorrectly...
 
In VBA, use the Value property, not the Text property. Text is available
only when the control has the focus and it represents what is in the
control's visible display.

Second, assuming that DateEntered is a date/time format, try this:

mydate = TxtDateSelect.Value
Me.Filter = "DateEntered = #" & mydate & "#"
Me.FilterOn = True

I am assuming that TxtDateSelect is also date/time formatted.
 
Back
Top