Querying a number between different fields.

  • Thread starter Thread starter Craig Fellows
  • Start date Start date
C

Craig Fellows

Hello,

We have a problem I'm hoping someone can help.

We have 2 fields, first field is a "Begin Number". The
second field is an "End Number". Which will define a range
of numbers within a single record.

So example data would be as follows

BeginNumber EndNumber
1 20

I want the users (at a later date) to be able to enter a
number in between this range, for example 10 and it will
find the record as demonstrated above.

Any ideas how this can be done anyone?
 
You could try the following in your query:

WHERE BeginNumber >= 1 And EndNumber <= 20
 
Let me take that back. Give this a try instead -- changing the table name
and field names appropriately.

SELECT BeginNumber,EndNumber
FROM tblNumbers
WHERE BeginNumber<=[Enter Number] AND EndNumber>=[Enter Number];
 
Lynn you sweet thing! that has worked a treat, we have
been pulling our bloody hair out about that one and yet it
seems so easy when you look at the SQL. Many Thanks.
-----Original Message-----
Let me take that back. Give this a try instead -- changing the table name
and field names appropriately.

SELECT BeginNumber,EndNumber
FROM tblNumbers
WHERE BeginNumber<=[Enter Number] AND EndNumber>=[Enter Number];


--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


You could try the following in your query:

WHERE BeginNumber >= 1 And EndNumber <= 20

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


.
 
You're quite welcome, Craig. My wife doesn't usually like it when men call
me "sweet thing", though! ;-)

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Craig Fellows said:
Lynn you sweet thing! that has worked a treat, we have
been pulling our bloody hair out about that one and yet it
seems so easy when you look at the SQL. Many Thanks.
-----Original Message-----
Let me take that back. Give this a try instead -- changing the table name
and field names appropriately.

SELECT BeginNumber,EndNumber
FROM tblNumbers
WHERE BeginNumber<=[Enter Number] AND EndNumber>=[Enter Number];


--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


You could try the following in your query:

WHERE BeginNumber >= 1 And EndNumber <= 20

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Hello,

We have a problem I'm hoping someone can help.

We have 2 fields, first field is a "Begin Number". The
second field is an "End Number". Which will define a range
of numbers within a single record.

So example data would be as follows

BeginNumber EndNumber
1 20

I want the users (at a later date) to be able to enter a
number in between this range, for example 10 and it will
find the record as demonstrated above.

Any ideas how this can be done anyone?


.
 
Back
Top