1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Access 2007 Date Query Problem.

Discussion in 'Software Development' started by Chelcone, Apr 7, 2009.

Thread Status:
Not open for further replies.
Advertisement
  1. Chelcone

    Chelcone Thread Starter

    Joined:
    Apr 7, 2009
    Messages:
    16
    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?
     
  2. Fluffmatic

    Fluffmatic

    Joined:
    Mar 21, 2009
    Messages:
    116
    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()"
     
  3. Chelcone

    Chelcone Thread Starter

    Joined:
    Apr 7, 2009
    Messages:
    16
    I may be being dence but how to i "Set the column to display "DateAdd("d",30,YourDateField) rather than simply "YourDateField"
     
  4. Fluffmatic

    Fluffmatic

    Joined:
    Mar 21, 2009
    Messages:
    116
    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.
     
  5. Chelcone

    Chelcone Thread Starter

    Joined:
    Apr 7, 2009
    Messages:
    16
    You sir are a life saver!! That has been annoying me for half of yesterday and today haha. That worked like a charm! :D
     
  6. Fluffmatic

    Fluffmatic

    Joined:
    Mar 21, 2009
    Messages:
    116
    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 ;-)
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/816579

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice