Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Range between 2 numbers (Access 2003)

    The original code I
    Cheers,
    Andy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Range between 2 numbers (Access 2003)

    Try
    <code>
    strWhere = strWhere & "([Inv_Mst_BinLoctn] Between """ & Me.txtLowerBound & """ And """ & Me.txtUpperBound & """) AND "
    </code>
    where txtLowerBound and txtUpperBoind are the text boxes containing the bounds. If it's for a number field instead of for a text field, you can change the triple instances of double quotes to single instances (<code>"</code> instead of <code>"""</code>)

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Range between 2 numbers (Access 2003)

    Hans,

    Try I did, and work it did!

    Outstanding as usual.

    Now, without pushing my luck with respect to using your time, what would the code be if I were looking for:

    txtQOH (a numeric field) greater than one number and less than the second number, otherwise

    txtQOH > 66 and txtQOH < 199.

    Thanks again, as always you're more than helpful. I obviously have no qualms with respect to the simplicity of some of the questions that I ask, because I'm positive that there's somebody else out there that will get equal benefit as I and not have to post the same question.

    Cheers,
    Cheers,
    Andy

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Range between 2 numbers (Access 2003)

    If txtQOH contains a whole number, <code>> 66 and < 199</code> is equivalent to <code>Between 67 and 198</code>. Assuming that your upper and lower limit are in text boxes, you can use
    <code>
    strWhere = strWhere & "([txtQOH] Between " & (Me.txtLowerBound + 1) & " And " & (Me.txtUpperBound - 1) & ") AND "
    </code>
    Alternatively, you could use
    <code>
    strWhere = strWhere & "([txtQOH] > " & Me.txtLowerBound & " AND [txtQOH] < " & Me.txtUpperBound & ") AND "
    </code>
    The latter will also work for numbers with decimals.

  5. #5
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Range between 2 numbers (Access 2003)

    Hans,

    Thank You!

    Cheers,
    Cheers,
    Andy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •