Results 1 to 4 of 4
  1. #1
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167

    + or - 100

    How would i create a criteria in a query that would return all records + or - 100 of the value in a field of a form. Note this text field only has numbers in it (no text)

    eg.
    ([Forms]![fCreateBilling]![Text161])


    has the number 1000 in it. I'm looking for a criteria that will return all records that have a value in this field between 900 and 1100

    the criteria i'm using is ...
    ([Forms]![fCreateBilling]![Text161]),+-100
    but this just causes errors

    can someone please help?

    tks

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    In the criteria row for the field,

    > 900 and <1100 'does not include 900 or 1100

    If you want to include the 900 and 1100, then
    Between 900 and 1100 'includes 900 and 1100
    or
    >= 900 and <= 1100 'includes 900 and 1100


    The WHERE clause of the query:
    Code:
    WHERE fCreateBilling!Text161 Between 900 And 1100;
    
    or
    
    WHERE fCreateBilling!Text161 >= 900 and <= 1100;




    EDIT:
    I might have misread the question.

    If you have a control on a form, the value in the control is 1000 and you want all records that are +-100 of that value, then try

    The WHERE clause of the query:
    Code:
    WHERE theField Between [Forms]![fCreateBilling]![Text161]-100 And [Forms]![fCreateBilling]![Text161]+100;
    Change theField to your field name


    -------------------------------------------------------------------------------------------
    In the criteria row for the field,

    > [Forms]![fCreateBilling]![Text161]-100 and <[Forms]![fCreateBilling]![Text161]+100
    >= [Forms]![fCreateBilling]![Text161]-100 and <=[Forms]![fCreateBilling]![Text161]+100

    Between [Forms]![fCreateBilling]![Text161]-100 And [Forms]![fCreateBilling]![Text161]+100

  3. #3
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167
    this works perfectly! thanks

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You're welcome. I will mark this solved for you.....

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

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