Sum() in Form Footer

G

Guest

Hi

Im using Windows 2000, Access 2000 and I have a continuous form holding
contribution data (1 record per year hence the continous form)

Both the text box on the form and the field in the table are called
dblNormalCbns

I want a total to appear in the form footer I use an unbound text box and
the formula =Sum([dblNormalCbns])

When i view the form i get #Error in the text box!

Am I doing something stupid?

reply here or to simon_cleal at hotmail

thanks

Simon
 
L

Lynn Trapp

You may have confused Access. Try changing the name of the text box to
txtNormalCbns and the formula to = Sum([txtNormalCbns]).
 
G

Guest

Thanks for your help Lynn

I tried what you said but it didn't work - it still comes up with #Error

Any more ideas?

Simon

Lynn Trapp said:
You may have confused Access. Try changing the name of the text box to
txtNormalCbns and the formula to = Sum([txtNormalCbns]).

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Simon Cleal said:
Hi

Im using Windows 2000, Access 2000 and I have a continuous form holding
contribution data (1 record per year hence the continous form)

Both the text box on the form and the field in the table are called
dblNormalCbns

I want a total to appear in the form footer I use an unbound text box and
the formula =Sum([dblNormalCbns])

When i view the form i get #Error in the text box!

Am I doing something stupid?

reply here or to simon_cleal at hotmail

thanks

Simon
 
J

John Vinson

I tried what you said but it didn't work - it still comes up with #Error

I believe you actually need to sum the fieldname (dblNormalCbns)
rather than the control name.

John W. Vinson[MVP]
 
P

Penguin

I tried Lynn's example on some sample data and the only thing I can
see is if your text box is formated for Text and not a Number.

Check your format property in your table.

Thanks for your help Lynn

I tried what you said but it didn't work - it still comes up with #Error

Any more ideas?

Simon

Lynn Trapp said:
You may have confused Access. Try changing the name of the text box to
txtNormalCbns and the formula to = Sum([txtNormalCbns]).

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Simon Cleal said:
Hi

Im using Windows 2000, Access 2000 and I have a continuous form holding
contribution data (1 record per year hence the continous form)

Both the text box on the form and the field in the table are called
dblNormalCbns

I want a total to appear in the form footer I use an unbound text box and
the formula =Sum([dblNormalCbns])

When i view the form i get #Error in the text box!

Am I doing something stupid?

reply here or to simon_cleal at hotmail

thanks

Simon
 
G

Guest

Hi:

I have the same scenario, i.e. the txttotal shows the total. However, I
added a checking wherein the form will not close if the the txttotal is not
equal to zero. Even if the txttotal shows a zero balance my message still
prompts stating the difference (by the way, the column consists of positive
and negative amounts) of "-2.328326.......E). Below is the code for the
Form_Unload. What seems to be the problem. Thanks.

If Me.txttotal.Value <> 0 Then
MsgBox "Your Trial Balance has " & Me.txttotal.Value & " unbalance
amount", vbInformation
End If
 
D

Douglas J Steele

That's the way it is with computers. Just as humans can't represent certain
values exactly using base 10 (one-third is .33333333333 repeating), so to
are there numbers that can be represented exactly in base 2. In fact,
there's an entire area of Computer Science dedicated to this problem:
Numerical Methods (or Numerical Analysis)

One approach is to decide "how close to zero" is good enough for you, and
use

If Abs(Me.txttotal.Value - 0) < 0.0001 Then

Another is to use the Format function to turn the number into a string:

If Format(Me.txttotal.Value, "0.00") = "0.00" Then

You could also try using the Currency data type, as it's specifically
designed to minimize round-off error.
 
G

Guest

I used the Abs and it works fine except that i changed the operation from <
to >. You're great. Many thanks.
 
D

Douglas J Steele

Sorry, I misread that you were looking for inequality, not equality! Glad it
solved your problem.
 

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

Similar Threads


Top