Solved

Microsoft Access Yesterday's Date

Posted on 2014-12-03
4
752 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
ID: 40478548
int(myDate) gives you the date but not the time.
0
 
LVL 24

Expert Comment

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

Author Closing Comment

by:davewalter1
ID: 40478564
Thank you! Worked perfectly.
0
 
LVL 47

Expert Comment

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

or

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

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

910 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

23 Experts available now in Live!

Get 1:1 Help Now