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  

Calculation



 
 
Thread Tools Display Modes
  #1  
Old December 12th, 2006, 08:07 PM posted to microsoft.public.access.forms
awach
external usenet poster
 
Posts: 198
Default 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  
Old December 12th, 2006, 08:15 PM posted to microsoft.public.access.forms
awach
external usenet poster
 
Posts: 198
Default 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  
Old December 12th, 2006, 08:35 PM posted to microsoft.public.access.forms
Sprinks
external usenet poster
 
Posts: 531
Default 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  
Old December 13th, 2006, 12:05 AM posted to microsoft.public.access.forms
Damian S
external usenet poster
 
Posts: 741
Default 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  
Old December 13th, 2006, 03:25 PM posted to microsoft.public.access.forms
Sprinks
external usenet poster
 
Posts: 531
Default 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  
Old December 13th, 2006, 05:12 PM posted to microsoft.public.access.forms
awach
external usenet poster
 
Posts: 198
Default 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

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 11:36 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.