×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Dates not working
2

Dates not working

Dates not working

(OP)
I have dates formatted as general date. Input mask in forms is 99/99/0000\ 00:00;0;_ When I try to query these dates using #02/18/2018# nothing results. If I use a between with the previous day and next day it will work. What am I doing incorrectly?

RE: Dates not working

Hi

If the dates in your table also have a time component, for instance 2/18/2018 08:43, then the value will be Equal to or Greater than 2/18/2018 And Less than the next day., 2/19/2018.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Dates not working

(OP)
Thanks. Evidently I have never used a date with a time component in the same field.

RE: Dates not working

Well, here, in North Texas it's 2/19/18 18:04:37.

That's just a display value. The ACTUAL value is 43150.7532. That is
1) 43,150 days since December 31 1899 (meaning that 1 would be displayed as 1/1/1900) and
2) the time value is 7,532 ten-thousandths of a day, which is displayed as 18 hours and 4 minutes and 37 seconds.

If you want to use #02/18/2018# in your SQL, then you'll need to do something like this...

CODE

Where Int([Your Date Field]) = #02/18/2018# 
... in order to return the integer portion of the date/time value.


Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Dates not working

(OP)
I can't try it right now but just curious can I also use Where Int([Your Date Field]) = date() to return the records that have the current date?

RE: Dates not working

LimitedTech,

You can easily test this kind of stuff (when you can run Access). I open the debug/immediate window (press Ctrl+G) and enter something like:

CODE --> immediate

? Int(#2/20/2018 6:00PM#)=Date()
True
? Int(Now())=Date()
True 

I prefer to use the DateValue() function to strip the time from a date/time value.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016

RE: Dates not working

(OP)
awesome thanks!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close