Results 1 to 4 of 4
  1. #1
    Maverick28 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2017
    Posts
    6

    less than not working for numeric values with a decimal

    Hi all,



    In a query I am using an Iif. The expression reads if a value in a column is <3 then "Y","N".

    This works perfectly fine except for on lines where there is 3.9 for example, where it will return Y.

    How can I get around this? In Excel it works fine.

    TIA!

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    I suspect that your column field is of type Text, in which case it would need to be converted to a number. Try:

    Code:
    Result: IIf(CSng([YourColumnField])<3,"Y","N")
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Maverick28 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2017
    Posts
    6
    Gave this a try, but unfortunately didn`t work. I have checked the format of the field and it`s Number. I was trying to do a calculation in the if, in the same way I would do it in Excel. It looks like I will have to do in multiple steps...

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Perhap you should show your actual formula. I had the same thought Bob did, though even text would evaluate 3.9 as greater than 3. Unless I've had too much wine.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Ordering Numeric Values
    By kazaccess in forum Access
    Replies: 7
    Last Post: 12-31-2013, 02:00 PM
  2. FindFirst Not Working with Decimal Data Type
    By JonMulder in forum Programming
    Replies: 5
    Last Post: 01-22-2013, 01:26 PM
  3. Only show numeric values
    By dr4ke in forum Queries
    Replies: 2
    Last Post: 07-22-2012, 05:09 AM
  4. Setting Up DB with numeric values
    By dashingirish in forum Access
    Replies: 4
    Last Post: 02-17-2012, 03:41 PM
  5. Updating Numeric Values
    By dssrun in forum Queries
    Replies: 9
    Last Post: 11-24-2010, 11:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums