Sum If Not Statement

  • Thread starter hobbit2612 via AccessMonster.com
  • Start date
H

hobbit2612 via AccessMonster.com

Hi, I wonder whether someone can help me please.

I currently have a text box with the following control source code within it:

=Sum(IIf(Not[Impact],[TotalCost],0))

Basically this takes the figure in the 'TotalCost' box on a continuous
Subform and where the tick box 'Impact' isn't ticked it takes the figure and
puts it on the main form.

What I would like to do is to add another variable from another tick box
again on the continuous subform. This time it's called 'StatusSelected' and
again where it isn't ticked I want it to take the 'TotalCost' figure and put
it on the main form, so basically the 'TotalCost' figure has to match both
criteria.

I've tried the following code:

=Sum(IIf(Not[Impact], [StatusSelected], [TotalCost],0))

But all I get is 'The expression you entered has a function containing the
wrong number of arguments.

I then tried:

=Sum(IIf(Not[Impact]&[StatusSelected], [TotalCost],0))

But all I get is an #Error in the text box containing the code.

Can anyone help me out please?

Many thanks

Chris
 
D

Dorian

I think this is what you want:

=Sum(IIf(Not[Impact] AND Not[StatusSelected],[TotalCost],0))

-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
H

hobbit2612 via AccessMonster.com

Hi Dorian, many thanks for taking the time to help.

I've tried the code and unfortunately I get the '#Error' error.

Any ideas please.

Regards

Chris
I think this is what you want:

=Sum(IIf(Not[Impact] AND Not[StatusSelected],[TotalCost],0))

-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
Hi, I wonder whether someone can help me please.
[quoted text clipped - 30 lines]
 
H

hobbit2612 via AccessMonster.com

Hi Dorian,

Apologies, please ignore my last post, I had included a typo in the code.

The code works a treat. Many thanks for your time and the solution, it really
is appreciated.

Kind regards

Chris
Hi Dorian, many thanks for taking the time to help.

I've tried the code and unfortunately I get the '#Error' error.

Any ideas please.

Regards

Chris
I think this is what you want:
[quoted text clipped - 9 lines]
 

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