Access 2007 afterupdate problem

Jon

Access World Site Owner
Staff member
Local time
Today, 13:34
Joined
Sep 28, 1999
Messages
8,192
I have 3 fields where amounts are entered and a 4th field that should show the total of these 3 fields. Normally, I would use a calculated field but previously this totals field had values entered into it manually.

So, I created some code to total the fields up. Here it is:

Code:
[Total Invoiced]=nz([Invoice Amount - Deposit])+nz([Invoice Amount - Balance])+nz([Invoice Amount - Extras bar Amt])

Something is not right, because if I delete amounts or enter amounts, sometimes it provides the correct total in the Totals field but sometimes it doesn't. I have code on each after update event for the first 3 fields.

Any idea what the problem might be?
 
Code:
[Total Invoiced]=nz([Invoice Amount - Deposit][B][COLOR=red],0[/COLOR][/B])+nz([Invoice Amount - Balance][B][COLOR=red],0[/COLOR][/B])+nz([Invoice Amount - Extras bar Amt][B][COLOR=red],0[/COLOR][/B])

Changes are highlighted in red.

The second part of nz is what the function should replace a null value with, I assume you want it replaced with zero in your sum.
 
Jon,

Also, you have it as:

[Invoice Amount - Deposit]

Each field name should be surrounded by the square brackets if necessary, so it should have actually been:

[Invoice Amount] - [Deposit]

Then you can follow CBrighton's advice.
 
I suspect that's the field name, all 3 have the prefix "Invoice Amount - "
 
Thanks for your help guys. I found out what the problem was. It was a bug after all. I just deleted the fields, re-added them and linked up the same code. It is now working. Sorted!
 
Are you going to dish out points for the suggestions? Lol just kidding :)

Glad it's sorted.
 

Users who are viewing this thread

Back
Top Bottom