Entering Time values in an iiF Statement

Gringarlow

New member
Local time
Today, 11:37
Joined
Mar 12, 2013
Messages
8
I'm creating a Select Query and want to create a field that uses another existing field in the query. The existing fiels is [GDS Rcvd Time] and is formatted as date/time.
The new field I want to create will be either "Yes" or "No" based on the result of the following:
If [GDS Rcvd Time] is before 5PM "yes" otherwise "no"
I'm not sure how to enter 5PM in the IF Statement in Access.
Thanks
 
Every entry comes back as No when I run the query.
The table that GDS Rcvd Time comes from has the field format as hh\:nn
This what I entered into the query Field:
B4 5PM: IIf([GDS Rcvd Time]<#17:00#,"Yes","No"),
when i move to a different field it changes to:
B4 5PM: IIf([GDS Rcvd Time]<#5:00:00 PM#,"Yes","No")
Either way, there are several times where the result should be "Yes".
 
I would double check your data. Just tested that and it worked as expected. Your field isn't text, is it (not the format, the data type)?
 
Does the field include a date portion? If so:

IIf(TimeValue([GDS Rcvd Time])<#17:00#,"Yes","No")

Can you post the db here, or a representative sample?
 
No problem, and welcome to the site by the way!
 

Users who are viewing this thread

Back
Top Bottom