View Full Version : Date Range Problem in Query


Chad Anderson
04-07-2009, 05:31 AM
I have a sql database that I have linked tables to in Access. I am trying to run a query on date ranges using either "between . . . and" or >= and <=, but the last day is not being included in the query.

Here is the criteria I have for the query.

Between [Forms]![frmbankrecreport]![From Date] And [Forms]![frmbankrecreport]![To Date]

I am using Access 2003. The source table that we are linked to has a datetime data type, so I am wondering if the problem is with the data type. Any suggestions on how to get this fixed?

Brianwarnock
04-07-2009, 05:44 AM
Does the field that you are checking have time and the form input not,
A date quoted wiyhout a time defaults to a time of 00:00:00 and thus is less than any similar date with a time.
Try
...And [Forms]![frmbankrecreport]![To Date] + #23:59:59#


Brian

Chad Anderson
04-07-2009, 08:47 AM
That was exactly the problem. Thank you very much!!

Brianwarnock
04-07-2009, 08:50 AM
Been there done that, happy to pass on experience. :D

Brian

raskew
04-07-2009, 09:07 AM
Good Call!

'experience' -- Is that like 'old age'?

Best wishes - Bob

Rabbie
04-08-2009, 01:18 AM
Good Call!

'experience' -- Is that like 'old age'?

Best wishes - Bob
'experience' is positive
'Old age' is less so:D

Mind you some people I know have many years experience while others have 1 years experience many times;)