Solved

Microsoft Access Yesterday's Date

Posted on 2014-12-03
4
948 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

860 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