Access - format date/time to date

Posted on 2013-05-31
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 48

Accepted Solution

Dale Fye earned 2000 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 48

Expert Comment

by:Dale Fye
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 48

Expert Comment

by:Dale Fye
ID: 39212004

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
In this article, we’ll look at how to deploy ProxySQL.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

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