Results 1 to 6 of 6
  1. #1
    noobaccess is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    22

    Greater than query

    Hi all,



    i am facing this problem that i cant understand why it actually appear it this way.

    i am trying to display records that are above 40, so i use a >40 in my query, however it does not show the records that are all more than 40, it shows records that are less than 40. I have a query that is <40 it is working fine, so i cant understand what the problem is. The inputs have numbers like 50-100, 40-50. Is that the reason why it couldnt work?

    Can someone help?

    Attach is my records that i get when i search for items > 40.

    thanks in advance!

    Click image for larger version. 

Name:	above.jpg 
Views:	7 
Size:	18.0 KB 
ID:	10251

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Your problem is that your field is text, so you're getting an alphabetic comparison. I would use one or two numeric fields, depending on what those numbers represent.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    noobaccess is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    22
    if i change it to numeric field, i wont be able to enter strings like 5-10, 10-20 am i correct?

    i actually want to set it as a range like from 5-10 and when i click on "below 10" in my combo box, it should appear in my result, is it possible to do that?

  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,652
    I don't understand the data, but "5-10" isn't a price point, it's a range. That's why I was thinking two fields, for the upper and lower boundaries.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    If you are using a query, and you want to specify a range, use BETWEEN. For example, 5 - 10 would be expressed as between 5 and 10, and can be used in query criteria. It becomes part of the WHERE clause - use the SQL View of a query to see the syntax.

    You will have to change your field data type to numeric.

    HTH

    John

  6. #6
    noobaccess is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    22
    oh okay! i understand better now! Many many thanks!!!!!!

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

Similar Threads

  1. If greater than 0 then...
    By wilbr73 in forum Programming
    Replies: 8
    Last Post: 11-29-2012, 03:47 PM
  2. Greater than or equal to date
    By stryder09 in forum Access
    Replies: 1
    Last Post: 04-14-2011, 03:54 PM
  3. Joins to get records greater than
    By thart21 in forum Queries
    Replies: 10
    Last Post: 09-15-2010, 08:45 AM
  4. Greater than date
    By I-am-me in forum Queries
    Replies: 1
    Last Post: 08-18-2009, 05:21 AM
  5. Replies: 0
    Last Post: 04-03-2009, 01:15 PM

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