Solved

Access - format date/time to date

Posted on 2013-05-31
5
995 Views
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.
0
Comment
Question by:patriotpacer
[X]
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
5 Comments
 
LVL 47

Accepted Solution

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

Author Comment

by:patriotpacer
ID: 39211964
Thx.

Anything I need to change to put this in SQL?  I'm getting a data type mismatch error.
0
 
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.

Try:

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

Author Closing Comment

by:patriotpacer
ID: 39211998
Thx!
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39212004
Welcome!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

696 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