Count books with start and end numbers

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

Michel Walsh

DCount("*", "tableNameHere", "BookSerialNumber BETWEEN
FORMS!formName!StartingSerialNumber AND FORMS!formName!EndingSerialNumber" )



Hoping it may help,
Vanderghast, Access MVP
 
M

Marshall Barton

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
 
J

John Spencer

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
..
 

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

Similar Threads


Top