Filtering a Query using the Me.Filter function

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

I am trying to filter the results of a query by date by
using the me.filter command that executes each time my
report opens (I have to do this because I have several
sub-reports in one report that reference different
queries).

I have a column in my query called "datereq". I want to
pass a filter in "Me.Filter" = (datereq <= " & Forms!
[Report Writer]!text12.value & ")" but it does not work.
If did show me the 2 records out of 4356 that had bad
dates (7/7/303 for example), but did not filter what I
wanted.

Any suggestions?
 
Delimit the dates with "#", and explicitly format them:

Me.Filter = "[datereq] = " & Format(Forms![Report Writer]!text12,
"\#mm\/dd\/yyyy\#")

Note that this will not work if you have just entered a value and not yet
moved the focus from text12 to another control.


If text12 is an unbound text box, setting its Format property to Short Date
can also help Access identify the data type.
 

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

Similar Threads


Back
Top