IIf Between And and Time fields

MadAtMicrosoft

Registered User.
Local time
Yesterday, 23:21
Joined
Sep 27, 2010
Messages
18
Hello again and thanks in advance to any responses.

On a Form I am attempting to use a Time field "StartTime" and perform the following IIf( (Between And)) in an Unbound txtbox

=IIf(([StartTime] Between #10:00:00 AM# And #11:59:00 AM#),1,2)

Regardless of any time values I insert into the function the Between And always returns the false value of 2 even if my StartTime Field is actually between the indicated times.

My starttime Field is set to (Medium Time)

Any idea on what I am missing?
 
Hey thanks.... It was a sample data issue and field Default value issue.

After I downloaded your sample db and saw that it worked, I went back to mine and it still wouldn't display anything but the value 2.

So I then went into my table and on the surface at least it looked right. However whenever I clicked on the time field it had DateANDTime. That got me to wondering. So I deleted the fields date portion. Sure enough, the date being inside that field was the issue. Then I looked at my default values. They were set to Now() Changed that to Time() for the time field and Date() for the date field and now it works.
 

Users who are viewing this thread

Back
Top Bottom