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!

DCount on a report...

Status
Not open for further replies.

SherryLynn

Technical User
Feb 4, 2001
171
CA
On my main form the user selects an item from a list.
On my report I need to calculate how many times the user selected one of the options. For this I have been using the DCount function. However, in a couple of categories on the report, I need to calculate how many times the user selects 2 different items from the list. A total count of these.

Eg. On the form:

User selects from Legal Status field - Permanent Guardianship on one record. On the next record he chooses Temporary Guardianship.

In the report:

The category Legal Status adds both of these status for a total count. Say there were 3 selections for Permanent and 2 for Temporary, then I would want to see 5 for that total.

Can I achieve this using the DCount function in a calculated control? Is there a way to add these fields together? Please help.

Thanks, Sherry
 
If you can count each independently with a dcount, you can add them together in one statement in a control like this:

=DCount(...)+DCount(...)

I didn't fill in the contents of the DCount's. Just used the dots to make it easier to visualize.

HTH Joe Miller
joe.miller@flotech.net
 
Hi Joe,

Just to clarify, do you mean make a separate control for each count individually and then another control with all of the statements added with + signs.

EG. Control 1 Dcount(...)
Control 2 Dcount(...)
Control 3 Dcount(...)+Dcoun(...)
?

Sherry
 
If you make separate controls (which you can) add the control names together in the third control.

Control 1 Dcount(...)
Control 2 Dcount(...)
Control 3 [Control 1]+[Control 2]

OR have one box perform both counts and add them together (this is what I'd do personally):

Control 1 Dcount(...)+Dcount(...)

Joe Miller
joe.miller@flotech.net
 
Thanks very much Joe. It worked perfectly (all in one control).

Sherry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top