A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Sum If Not Statement



 
 
Thread Tools Display Modes
  #1  
Old January 14th, 2010, 06:16 PM posted to microsoft.public.access.forms
hobbit2612 via AccessMonster.com
external usenet poster
 
Posts: 107
Default Sum If Not Statement

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

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #2  
Old January 14th, 2010, 07:58 PM posted to microsoft.public.access.forms
Dorian
external usenet poster
 
Posts: 542
Default Sum If Not Statement

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".


"hobbit2612 via AccessMonster.com" wrote:

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

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

.

  #3  
Old January 14th, 2010, 08:56 PM posted to microsoft.public.access.forms
hobbit2612 via AccessMonster.com
external usenet poster
 
Posts: 107
Default Sum If Not Statement

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

Dorian wrote:
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]

Chris


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #4  
Old January 14th, 2010, 09:32 PM posted to microsoft.public.access.forms
hobbit2612 via AccessMonster.com
external usenet poster
 
Posts: 107
Default Sum If Not Statement

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

hobbit2612 wrote:
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]

Chris


--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:29 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.