Filter form by 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
 
P

Phil Pereira

Phil Pereira wrote:

What I meant to say was, I'm pretty sure I'm formatting the filter
incorrectly...
 
P

Phil Pereira

Phil Pereira wrote:

What I meant to say was, I'm pretty sure I'm formatting the filter
incorrectly...
 
K

Ken Snell

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top