Count books with start and end numbers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I count a series of books with start and end book numbers?
I have a query, qryBooks, that has a box number and a start and end value
for a series of books (100000 - 100010) 11 books.

How do I get a query to count the books in the series and return a total to
me?
 
DCount("*", "tableNameHere", "BookSerialNumber BETWEEN
FORMS!formName!StartingSerialNumber AND FORMS!formName!EndingSerialNumber" )



Hoping it may help,
Vanderghast, Access MVP
 
Ripper said:
How do I count a series of books with start and end book numbers?
I have a query, qryBooks, that has a box number and a start and end value
for a series of books (100000 - 100010) 11 books.

How do I get a query to count the books in the series and return a total to
me?


SELECT box, endnumber - startnumber + 1
FROM sometable

or a total of all boxes

SELECT Sum(endnumber - startnumber + 1)
FROM sometable
 
Use the expression

EndValue-StartValue +1

to calculate how many books in the box.

If you want to get the sum of those numbers
SUM(EndValue-StartValue +1 ) as CountBooksInGroup


You didn't say how or even if you were grouping items.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top