Record Counter

  • Thread starter injanib via AccessMonster.com
  • Start date
I

injanib via AccessMonster.com

I have an unbound textbox at the end of my form that counts and displays
records on the form. I have the following code in the control source.

="Total Pieces Received : " & Count([TrackingNumber])

This counts all the tracking number of all the packages that appear under the
TrackingNumber field.
I have another field called Status that is a Yes/No Field. It shows if the
package has been delivered.
I also have another unbound text box that should display the number of
packages delivered.
How can I modify the code above to look under field "Status" and cound the
records with "Yes" value?
 
J

Jeff Boyce

If the underlying field is defined as a Yes/No field, summing the field
(instead of counting) gives you a number of Yes's. "No's" are recorded as
zeros. "Yes's" are recorded as -1's in Access/JET, and as 1's in
SQL-Server.

If you sum up the field, then take the absolute value, you're assured of
having a positive number (i.e., the "count" of "Yes's").

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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