Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Dec 2004
    Thanked 0 Times in 0 Posts

    Date criteria (Access 97)

    I'm sure this has an easy answer I am just a newbie retard. I enter about twenty records a day into my database. There is a field in the record that called "today's date." I would like a to create a query that shows me all the of the records for the most recent day, that excludes all previous day's records. Lets say I enter data on Friday, then I come back to work on Monday. I want to open the query and (without manualy selecting the date) Fridays records are displayed.

    I figure I have to put something in the criterea for "today's date" in the query, but I don't know what. The main thing is I don't want to have to select the date, I just want the most recent date. Does any of this make sense? Please Help!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 29 Times in 29 Posts

    Re: Date criteria (Access 97)

    Say that your table is named tblData. Put the following in the Criteria line under the date field:

    (SELECT Max([Today's date]) FROM [tblData])

    Note: using spaces and punctuation in the name of fields, tables etc. is not a very good idea. It forces you to put square brackets around the name in queries, expressions and in VBA code, and may lead to unexpected results.

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Evergreen, CO, USA
    Thanked 64 Times in 63 Posts

    Re: Date criteria (Access 97)

    Hans' suggestion will do the trick the first time you open the database on a given date. If however you close the database and reopen it, you will only see records for the current date. A bit more complex approach would be to calculate the previous date using date arithmetic - in most cases you would simply subtract 1 day, but on Monday you would need to subtract 3 days. Using the Weekday() function you can determine what day the current date is - i.e. Weekday(Date()).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts