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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|