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
|
|||
|
|||
Calculation
I have a continous subform where the user can enter a value [Actual Amount].
Then there is a value, named [Total], that sums all of those amounts: Sum([Actual Amount]). However, there is a case where there may not be any records entered. In that case, I would like [Total] to equal 0. I tried IIf(IsNull([ActualAmount]),0,=Sum([ActualAmount]) but it doesn't seem to be working. Any ideas? |
#2
|
|||
|
|||
Calculation
I forgot to say, what I mean by "not working" is that it doesn't return any
value (not zero) and it doesn't display an error message. (Sorry about the re-post). "awach" wrote: I have a continous subform where the user can enter a value [Actual Amount]. Then there is a value, named [Total], that sums all of those amounts: Sum([Actual Amount]). However, there is a case where there may not be any records entered. In that case, I would like [Total] to equal 0. I tried IIf(IsNull([ActualAmount]),0,=Sum([ActualAmount]) but it doesn't seem to be working. Any ideas? |
#3
|
|||
|
|||
Calculation
Awach,
Convert Null values to zero with the Nz function. See VBA Help for further information and options. Try: =Sum(Nz([ActualAmount])) Sprinks "awach" wrote: I have a continous subform where the user can enter a value [Actual Amount]. Then there is a value, named [Total], that sums all of those amounts: Sum([Actual Amount]). However, there is a case where there may not be any records entered. In that case, I would like [Total] to equal 0. I tried IIf(IsNull([ActualAmount]),0,=Sum([ActualAmount]) but it doesn't seem to be working. Any ideas? |
#4
|
|||
|
|||
Calculation
You missed the ,0
=Sum(Nz([ActualAmount], 0)) D. "Sprinks" wrote: Awach, Convert Null values to zero with the Nz function. See VBA Help for further information and options. Try: =Sum(Nz([ActualAmount])) Sprinks "awach" wrote: I have a continous subform where the user can enter a value [Actual Amount]. Then there is a value, named [Total], that sums all of those amounts: Sum([Actual Amount]). However, there is a case where there may not be any records entered. In that case, I would like [Total] to equal 0. I tried IIf(IsNull([ActualAmount]),0,=Sum([ActualAmount]) but it doesn't seem to be working. Any ideas? |
#5
|
|||
|
|||
Calculation
Damian,
The last parameter is optional. If omitted for numeric values, the function will return zero by default. Sprinks "Damian S" wrote: You missed the ,0 =Sum(Nz([ActualAmount], 0)) D. "Sprinks" wrote: Awach, Convert Null values to zero with the Nz function. See VBA Help for further information and options. Try: =Sum(Nz([ActualAmount])) Sprinks "awach" wrote: I have a continous subform where the user can enter a value [Actual Amount]. Then there is a value, named [Total], that sums all of those amounts: Sum([Actual Amount]). However, there is a case where there may not be any records entered. In that case, I would like [Total] to equal 0. I tried IIf(IsNull([ActualAmount]),0,=Sum([ActualAmount]) but it doesn't seem to be working. Any ideas? |
#6
|
|||
|
|||
Calculation
That still isn't working. Is it supposed to work if ther are no records for
ActualAmount. That seems to be where I run into problems. Any ideas? "Sprinks" wrote: Awach, Convert Null values to zero with the Nz function. See VBA Help for further information and options. Try: =Sum(Nz([ActualAmount])) Sprinks "awach" wrote: I have a continous subform where the user can enter a value [Actual Amount]. Then there is a value, named [Total], that sums all of those amounts: Sum([Actual Amount]). However, there is a case where there may not be any records entered. In that case, I would like [Total] to equal 0. I tried IIf(IsNull([ActualAmount]),0,=Sum([ActualAmount]) but it doesn't seem to be working. Any ideas? |
Thread Tools | |
Display Modes | |
|
|