Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to find number of records within a range

Status
Not open for further replies.
Jun 4, 2004
159
US
Ok...this is an easy one...hopefully. I have a table (Contact1) with a field "ACRES". I need to find out how many records have between 50 and 100 acres. This is what I have....but it is wrong:
Select ACRES
From TableContact1
Where Contact1.ACRES >50 & Contact1.ACRES <100

I think I am making it harder than it needs to be.
Thanks!


K. Kemp

 
Try this:

Code:
Where Contact1.ACRES >50 AND Contact1.ACRES <100

HOpe it helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
SELECT Count(*) FROM TableContact1 WHERE ACRES Between 50 And 100

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Maybe your numbers are stored as text?

Code:
Where Contact1.ACRES >'50' AND Contact1.ACRES <'100'
could work.

If they are stored as text you really should change column data type to numeric though.

Hope this helps,

Alex


Ignorance of certain subjects is a great part of wisdom
 
If ACRES is text then
[red]Where Contact1.ACRES >'50' AND Contact1.ACRES <'100'[/red]
will never return any records. This would be like
[red]Where LastName >'Na' AND LastName <'Baa'[/red]


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top