Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coding question regarding the sum of all records 1

Status
Not open for further replies.

eon5

Technical User
Dec 31, 2007
47
ZA
I have created a form with the following information;


Key field1 field2
Records ID: Expense1: Expense2:
001 R20 R25
002 R15 R10

Of course the form is displaying only one record at a time with the values of Expense1 and Expense2 in it. In the one corner of the form I have created a text box displaying the sum of the two expenses.

" = [Expense1] +[Expense2] = R45 "

All of this is working perfectly, but how do I code another text box on the same form displaying the total value for expense 1 and 2 for all the records entered thus far. In other words the text box should read R70.

Thanks
Eon5
 
How are ya eon5 . . .

Try this:
Code:
[blue]= Sum(Nz([Expense1],0)+Nz([Expense2],0)[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hi AceMan,

It’s nice to get some good advice from you again.

Thanks I will try the code and let you know.

Hope this is not a stupid question, but what does the Nz stand for?

Eon5
 
eon5 . . .

Basicaly [blue]Null to Zero[/blue]. It replaces nulls in a field with zero. Nulls cause problems in calculations.

Have a look at it in VBA help!

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
The code works perfectly, thanks

eon5
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top