# Solved: Access 2007 Date Query Problem.



## Chelcone (Apr 7, 2009)

Hi all.

I hope somone can help this is starting to annoy me.

I am building a database for the charity i work for to track our collection boxes that are out and about.
I am trying to put a button in so it will pull out all boxes that have been out for greater than 30 days. To do this i am using the field "Date Out" in the query and the criteria is:

>Date()-30

This works but pulls our 200,000 results when there are only 1400 records in the table.

any ideas?


----------



## Fluffmatic (Mar 21, 2009)

I believe the dateadd function is what you need. Set the column to display "DateAdd("d",30,YourDateField) rather than simply "YourDateField", and then add the criteria "> now()"


----------



## Chelcone (Apr 7, 2009)

I may be being dence but how to i "Set the column to display "DateAdd("d",30,YourDateField) rather than simply "YourDateField"


----------



## Fluffmatic (Mar 21, 2009)

Hi,

In the column for this field it should show the field name you're displaying, simply copy and paste this formula in there. It'll insert some text at the start "Expr1:", don't worry about this, but you can change it if you like as long as you leave the ":" in place.


----------



## Chelcone (Apr 7, 2009)

You sir are a life saver!! That has been annoying me for half of yesterday and today haha. That worked like a charm!


----------



## Fluffmatic (Mar 21, 2009)

Glad to be able to help, I know how it feels to struggle like that, I seem to recall having a day pulling my hair out the first ever time I wanted to do the same thing, hence it stuck in my memory ;-)


----------

