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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count conditional results on several fields

Status
Not open for further replies.

BaudKarma

Programmer
Feb 11, 2005
194
US
Designing a report for our quarterly bonus program. Table layout, field names, etc were set up before I got here, and can't be changed for various reasons.

We have five fields in the table which can get set yes/no. What I want to do is count how many of those five fields are set to "yes", and print that number on the report.

In previous cases like this, I've written a function to do the count. I pass the store number as a function argument, then use DLookup to check each of the fields and perform the math.
Unfortunately, the field names in the database are things like [Team - Turnover], which causes DLookup to have conniptions.

Any workarounds for this problem, or alternate solutions?

 
Add a text box to the report with its control source something like this:
Code:
=Abs([Team - Turnover]+[Team - Whatever]+[Team...])
This should return the count of "Yes" fields.

Si hoc legere scis, nimis eruditionis habes
 
I probably should have mentioned that the yes/no fields are plain 'ol text fields, not boolean. However, it looks like I can go change the field type and make sure the data displays as y/n instead of checkboxes. It'll be a little work, but less then redoing the whole database.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top