Solved

Microsoft Access Yesterday's Date

Posted on 2014-12-03
4
680 Views
Last Modified: 2014-12-03
I need to pull records entered "yesterday," from a table of records entered via a dotnet form. The date field in the table is formatted as Short Date, but the values coming in from the Web form include the time with the date.

Date()-1 returns no records, apparently because of the time component in the field. If I enter a date directly into the table, the query works, I'm assuming because there's just a date and no time.

Without changing the data entry form, is there a way to query these records and ignore the time?

Thank you!
0
Comment
Question by:davewalter1
  • 2
4 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
Comment Utility
int(myDate) gives you the date but not the time.
0
 
LVL 24

Expert Comment

by:Phillip Burton
Comment Utility
alternatively, you can do the criteria of >=int(now())-1 and <int(now())
0
 

Author Closing Comment

by:davewalter1
Comment Utility
Thank you! Worked perfectly.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
DateValue([yourField]) = Date() - 1

or

([yourField] >= Date() - 1) AND ([yourField] < Date())
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

771 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