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!

Range of values in query 1

Status
Not open for further replies.

67peshawar294

Technical User
Mar 8, 2001
388
US
Good morning everyone,
Is there a way to produce results from a query that shows increments of a field? [retpr] can be from $0.00 to $350.00. [nhere] from 0 to 5.
I want to output to a report that shows total of[nhere] for a range of prices
retpr nhere
0 to 49.99 [total of nhere]
50 to 99.99 [total of nhere]
100 to 149.99 [total of nhere]
. .
. .
. .
I thought about using several queries using >0 and <50.00 etc but seems awkward. Also tried several ways, functions using select case, for next but I am not adept enough to code.
Thanks for the help
Jim
 
In the &quot;criteria&quot; box of the query use the &quot;Between&quot; operator - can check with Help if unfamiliar...
 
I would create a custom function like:

Function GroupPrice(FeedPrice As Currency) As String

Select Case Price
Case 0 To 49.99
GroupPrice = &quot;0 to 49.99&quot;
Case 50 To 99.99
GroupPrice = &quot;50 to 99.99&quot;
Case 100 To 149.99
GroupPrice = &quot;100 to 149.99&quot;
End Select
End Function

Then, use this function as a grouping column in the Query -
GroupPrice([Price]) and then count the price (or something else)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top