Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access - format date/time to date

Posted on 2013-05-31
5
Medium Priority
?
1,033 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
  • 3
  • 2
5 Comments
 
LVL 49

Accepted Solution

by:
Dale Fye earned 2000 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 49

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.

Try:

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

Author Closing Comment

by:patriotpacer
ID: 39211998
Thx!
0
 
LVL 49

Expert Comment

by:Dale Fye
ID: 39212004
Welcome!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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 …

877 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