Code for comparison totals

  • Thread starter Thread starter Crys
  • Start date Start date
C

Crys

Ok, I'm sure this is possible, I just have no idea how to
do it. I have a database and I've made a report to pull
totals out of the db to a report. What I'm trying to do
now is break it down even further. I'm trying to write an
expression that will look at one field and if it finds a
true result to then search another field and count the
second field if the first one is true.
ie - search 1st field simple yes/no....2nd field has a
choice of 5 options. If the first field is yes I want it
to search the second field and count all records that are
a 1. I'm having trouble writing the control that will do
this. I keep getting an #Name ? error. Will be happy to
go into more detail if anyone can understand what I'm
trying to say or help. Thanks.
 
Crys said:
Ok, I'm sure this is possible, I just have no idea how to
do it. I have a database and I've made a report to pull
totals out of the db to a report. What I'm trying to do
now is break it down even further. I'm trying to write an
expression that will look at one field and if it finds a
true result to then search another field and count the
second field if the first one is true.
ie - search 1st field simple yes/no....2nd field has a
choice of 5 options. If the first field is yes I want it
to search the second field and count all records that are
a 1. I'm having trouble writing the control that will do
this. I keep getting an #Name ? error.


This sounds like it might be best addressed with a subreport
based on a totals or crosstab query.

To answer your immediate question, use a text box expression
like this:
=Abs(Sum(IIf([1stfield]=True And [2ndfield] =1))
 

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

Rich Text Format 0
Access Dcount (multiple criteria) 3
Subtotal for a record 8
Count or total a logocal field 5
How to Sum Total cost field in report 2
Count 3
Totals in a report 3
Expressions in Reports 7

Back
Top