Solved

Can't get query to return today's record

Posted on 2015-02-13
4
103 Views
Last Modified: 2015-02-13
See attached.  Why won't the query return today's record?
Query-Example.accdb
0
Comment
Question by:SteveL13
  • 2
4 Comments
 
LVL 49

Expert Comment

by:Gustav Brock
Comment Utility
That's because your dates include time. So have the expression DateValue(RecordedDate]) and filter on that, or ensure that clean dates without a time part are entered.

/gustav
0
 
LVL 11

Accepted Solution

by:
Wilder1626 earned 250 total points
Comment Utility
Hi

This should also work

SELECT tblRecords.ID, tblRecords.RecordDate
FROM tblRecords
WHERE (((tblRecords.RecordDate)>=Date())) and (((tblRecords.RecordDate)<=Date()+1));

Open in new window

0
 
LVL 34

Assisted Solution

by:PatHartman
PatHartman earned 250 total points
Comment Utility
The second part of Wilder's suggestion needs to be just < rather than <=.  You don't want midnight tomorrow to satisfy the criteria.
0
 
LVL 49

Expert Comment

by:Gustav Brock
Comment Utility
That would include dates of next day at Midnight as well.
But you could use:

WHERE tblRecords.RecordDate Between Date() And Date() + #23:59:59#;

or

WHERE (((tblRecords.RecordDate)>=Date())) and (((tblRecords.RecordDate)<Date()+1));

/gustav
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now