Results 1 to 10 of 10
  1. #1
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209

    Query to display ONLY entries from today

    I want to run a query that will only display the records that were input into the database TODAY, but I do not want to have to input the date on the query. If that makes sense; I want the query to prompt you to enter what user they want to query, and then display records for TODAY, not prompt asking what day to display records from. Is that possible?

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    I don't think you can do it unless you have a resource built into the tables that tells you when it was entered.

    do you have that? If not, I think you're out of luck. One way to do it would be a hidden field on your form with a default value of "date()".

    But regardless of that, you have to filter your query with a date of somekind. You have no choice. sorry

  3. #3
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209
    My table does display the date/time that the record was entered. Is that what you are referring to?

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by Juan4412 View Post
    My table does display the date/time that the record was entered. Is that what you are referring to?
    yes, use that in the query. you can't leave it out. it's not possible

  5. #5
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209
    Simply adding my "date_entered" field to the query will cause the query to only display the records entered from today?

  6. #6
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by Juan4412 View Post
    Simply adding my "date_entered" field to the query will cause the query to only display the records entered from today?
    are you familiar with queries Juan?

    you need a criteria clause. eg:
    Code:
    select ........... from.........
    
    where date_entered = date()
    make sense?

  7. #7
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209
    Somewhat. Could I set the date_entered = Today(), or if I chose Now(), would that be able to provide the records from that day only?

  8. #8
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by Juan4412 View Post
    Somewhat. Could I set the date_entered = Today(), or if I chose Now(), would that be able to provide the records from that day only?
    I don't think so, but you can try it. That includes time as well and it'll always return 0 records if that part is indeed included.

    Trial and error, Juan.

    If it doesn't, parse the date out with a date function...

  9. #9
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    I'm sorry Juan. I left you hanging there a little I guess.

    If you want to parse the date out of the NOW() function-based field of yours, you can do so like this:

    Code:
    SELECT ........... FROM ...........
    
    WHERE datevalue([date_entered]) = date()

  10. #10
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209
    That makes more sense. I can do the trial-and-error to determine what will work, and what will not work. Thank you for your assistance in this matter.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query to show blank entries
    By jo15765 in forum Queries
    Replies: 1
    Last Post: 12-09-2010, 08:15 AM
  2. Query to group and count field entries
    By newtoAccess in forum Queries
    Replies: 4
    Last Post: 11-29-2010, 09:19 AM
  3. Replies: 5
    Last Post: 01-28-2010, 09:10 AM
  4. Replies: 0
    Last Post: 04-03-2009, 01:15 PM
  5. query date that is five years older than today
    By cpsummer in forum Queries
    Replies: 2
    Last Post: 09-26-2007, 02:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums