Access - format date/time to date

Posted on 2013-05-31
Last Modified: 2013-05-31
I'm trying to do a query to remove the time aspect so that it just looks at the date alone.

and last_contact < format(now(), 'mm/dd/yy)-2

Open in new window

How do I fix this?  I wanna go back 2 days on the date by itself, not including the time.

last_contact is a date/time field.
Question by:patriotpacer
  • 3
  • 2
LVL 47

Accepted Solution

Dale Fye (Access MVP) earned 500 total points
ID: 39211962
AND DateValue([last_contact]) < DateAdd("d", -2, date())

Author Comment

ID: 39211964

Anything I need to change to put this in SQL?  I'm getting a data type mismatch error.
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39211996
I assumed that the syntax in your original post was a part of a SQL string WHERE clause.

If you are getting a data type error, then it is likely that [last_contact] is a string, not a date.


And datevalue(cdate([last_contact])) < dateadd("d", -2, date())

Author Closing Comment

ID: 39211998
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39212004

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

706 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

15 Experts available now in Live!

Get 1:1 Help Now