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

Counting Fields with Specific Criteria in a report 2

Status
Not open for further replies.

bethabernathy

Programmer
Jul 13, 2001
254
MX
Hi There: More counting problems. I have a report based on a query and I need to count the field "EquipstatID" when the data in the field is "Owned"

I want to count the record if it is "Owned"

So for example:

Equipment Status is Owned = 3 (for the report).

Any ideas. The only other thing is that the field "EquipstatID" is a lookup field in the table.

Thanks for all your great help. This forum has been so AWESOME!!!

Beth
 
Beth,

Did you try the DCount function for this too:
Code:
=DCount([EquipstatID],"tblYourTable","[EquipstatID] = 'Owned'")

Cosmo
 
Hi Cosmo:

I am getting an error using this:

=DCount([EquipstatID],"tblincident","[EquipstatID] = 'Owned'")

Any other ideas? Maybe I have the syntax incorrect?

Beth
 
HI- I am using this

=Count([EquipstatID])

and I get the total records in the table, which is a start. But... How can I get the records to be limited to
those with the criteria of "Owned"

Beth
 
Sorry Beth, my bad.....Try:
Code:
=DCount("[EquipstatID]","tblincident","[EquipstatID] = 'Owned'")
 
I don't know...this syntax works for me. Just for the heck of it, replace the table name with the query that's the report's record source:
Code:
=DCount("[EquipstatID]","qryQueryName","[EquipstatID] = 'Owned'")
Also, this is an unbound text box, right??
 
Hi Cosmo: Still getting an error. Strange, huh? It is an unbound text field. I tried this:

=Count("[EquipstatID]")="Owned"

and get the value of "0"

That isn't correct as there are 3 records with data "Owned."

Weird, huh? I tried creating a dummy field that isn't a lookup and it still isn't working.

This could be something with my table?? How is it working in your database??

Beth
 
Cosmo, Guess what the last syntax you sent me worked with my dummy field, which is not a look-up field. So it must be something with the "EquipstatID" being a look-up field, what do you think? Anyway around this.

Beth
 
A lookup field stores the foreign key (the ID) but displays the description. Try changing the criteria to the ID value for 'Owned':

=DCount("[EquipstatID]","qryQueryName","[EquipstatID] = 4")
with the 4 being whatever the ID is......
 
Genius!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Perfect. Works Perfectly. Thank you sooooooo much.

Beth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top