Link to home
Start Free TrialLog in
Avatar of Genius123
Genius123Flag for United States of America

asked on

Access Query with Time function

Hello,

In my query, I'm trying to put this in the criteria but getting errors with my syntax.  No matter the date, I'm just trying to set a time range.

TimeValue([WhateverDate]) > 4:30 PM and TimeValue([WhateverDate]) < 12:00 AM

Thanks,
Joel
Avatar of omgang
omgang
Flag of United States of America image

Dates/times in Access are indicated with # symbols.

Try

 TimeValue([WhateverDate]) > #4:30 PM# and TimeValue([WhateverDate]) < #12:00 AM#

OM Gang
Avatar of Genius123

ASKER

With that, I'm getting a Data type mismatch error.  But I know my [WhateverDate] field is a DateTime field, so I'm not sure why I'm getting the error....
I assume your whateverdate is not  a field name so:
 TimeValue(#2015-10-02 05:30:00 PM#) > #4:30 PM# and TimeValue(#2015-10-02 10:00:00 PM#) < #12:00 AM#

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Nick67
Nick67
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That worked, thank you very much.