Calculating sum in a form

IainMac

New member
Local time
Today, 06:42
Joined
Jul 7, 2003
Messages
3
I have a form based on a query that gives the user 4 choices (check boxes), if they check the box an amount is put into a text box (this is done with an expression in the query) and this works fine. What I can't work out is how I total the amounts into a 5th text box - I have tried =[Expr1]+[Expr2]+[Expr3]+[Expr4] and it displays the 4 seperate amounts as if it is joining 4 text strings - the fields are formatted as currency. I don't know enough to figure this one out, I'm sure it is quite straightforward, but I need you guys to help me please!
 
Try this:

=Val([Expr1])+Val([Expr2]) ..... etc.

Should work.
 
You might try :

=Sum(Nz([Expr1]+[Expr2]+[Expr3]+[Expr4]))
 
You should put that in the control source of the text box.
 
Your original code is correct. The problem is that the fields are text and so they are being concatenated instead of summed. Remove the formatting from the four fields and format the result field by setting the format property rather than using the Format() function. When you use the Format() function, the result is a string, no matter what it looks like.
 

Users who are viewing this thread

Back
Top Bottom