Problem with 'IIF' funtion in query

G

Guest

I have this 'IIF' funtion in an Access query that seems to be running okay;
but the value it is returning is not all correct. Here is my 'IIF' statement:
SameDay Availability: IIf([15 Min Same Day]>="3","Available","Not Available")

The data is imported through a text file with contains the number of
available 15-min slots for each day (time is not used in this database).

What the query should be doing is returning the value "Available" if the
value in the [15 Min Same Day] field is greater than or equal to "3";
otherwise, return "Not Available". It is doing this for some, but in some
instance it is returning "Available" where it should return "Not Available",
and returning "Not Available" where it should return "Available".

Can anyone help???? Thanks!
 
T

TPratt

It's because you're comparing [15 Min Same Day] to a Text field. Change the
field to be numeric and everything will work as you expect.
 
E

Edward Reid

PL/I proved forty years ago that automatically coercing every type to
every other type is a super bad idea, and yet we still live with
systems which do just that.

They never learn.

Edward
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top