Results 1 to 7 of 7
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528

    Between Condition is used to retrieve values within a range

    Hello Guys
    You design a query that includes fields from the first number and the second to
    What I want is
    How do I add a field inference looking for number falls between two numbers


    For example
    The first field contains the number 100120
    The second field contains the number 100130
    I want to type in the search field or combo box No. 100122 or 100127
    Show me the record above
    If I type 100 133 is not shown because it is not located between the two figures above.
    SELECT tblCategory.CustomerID, tblCategory.Of, tblCategory.To, tblCategory.Category, tblCategory.Qty, tblCategory.CustomerName, tblCategory.DateOf
    FROM tblCategory;
    Click image for larger version. 

Name:	32.JPG 
Views:	15 
Size:	20.7 KB 
ID:	15536

  2. #2
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    I do I enter a number in a text field unstructured (100300113)
    Greater than (Field Of)
    Smaller than (Field To)

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    This is NOT rocket science. Identify the operator and look to google/bing to find an example with documentation.

    For SQL look for examples at w3schools.

    For Between http://www.w3schools.com/sql/sql_between.asp

    For vba/Access functions see examples at TechOnTheNet

    eg Datepart http://www.techonthenet.com/access/f...e/datepart.php

  4. #4
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    in the query criteria add

    first field 'OF'
    >[Enter first value]

    on the same query line put

    second field 'AS'
    <[Enter second value]

    Ps having fields named AS and OF could cause you problems

    try tblOF and tblAS

  5. #5
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Good morning Trevor
    Thank you all
    But how do I put a field on the form
    For the purpose of search
    Attached Files Attached Files

  6. #6
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you Orange cat
    This is what I hoped
    SELECT *
    FROM Table1
    WHERE Field BETWEEN Field2 AND Field3;

  7. #7
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    between < Forms![your form name]![form field 1] and > Forms![your form name]![form field 2]

    try using the build optin to find your form then select from the field list the 2 fields

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

Similar Threads

  1. Replies: 2
    Last Post: 05-29-2013, 12:54 PM
  2. group by a range of values
    By therzakid in forum Queries
    Replies: 3
    Last Post: 07-24-2011, 02:22 PM
  3. Replies: 1
    Last Post: 12-14-2010, 10:03 PM
  4. Sum of Values over date range
    By bosnian in forum Queries
    Replies: 1
    Last Post: 01-12-2010, 03:41 PM
  5. Replies: 1
    Last Post: 06-20-2007, 07:26 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