Problem in a filter with to dates using Between condition
Posted on 2006-05-05
I'm building a report in access that should give some statistics of the records in a certain table. For that, i'm using Dcount to return the number of records that matches some criteria.
I'm uisn this two conditions in the Control Source property of the field:
Field 1 -> =DCount("Origem";"Investigacao";" Data Between #" & [Data1] & "# And #" & [Data2] & "#")
Field 2 -> =DCount("Origem";"Investigacao";("[Investigacao.Estado] Like 'Investigação' And [Investigacao.Origem]_ Like 'Aprovação Contrapartes' And Data Between #" & [Data1] & "# And #" & [Data2] & "#"))
[Data1] and [Data2] are inserted in a form and recorded in a specific table to this report
This two conditions returns exactly what is expected if i am using dates between 01-01-2005 and 30-04-2006. My problem beguns when the dates are like 01-05-2006 to 05-05-2006 (present day).
I have already tried to write the conditions replacing [Data1] for 01-05-2006 and still have no results.
If the conditions is changed to "Data like '01-05-2006'" returns the results correctly.
Thanks in advance.