Querying a number between different fields.

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?
 
L

Lynn Trapp

You could try the following in your query:

WHERE BeginNumber >= 1 And EndNumber <= 20
 
L

Lynn Trapp

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];
 
C

Craig Fellows

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


.
 
L

Lynn Trapp

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?


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top