Creating an invoice report

the bard

Registered User.
Local time
Today, 20:48
Joined
Oct 4, 2007
Messages
60
I am trying to create an invoice with up to 5 items.Each item is sub-totalled using Total1 = Price1*Quantity1 throught to item 5. I use the formula Totalgoods=Total1 + Total2 etc which works provided there are 5 items, any less and it will not total. I have tried various other ways to total without success. Any ideas?
 
You need my favourite function: Nz. The problem is probably that the unused items are Null, so Access falls over them rather than doing the human thing of treating them as zero. Change your total to read: Totalgoods = Nz(Total1,0)+Nz(Total2,0) . . .
 
Last edited by a moderator:
I use the formula Totalgoods=Total1 + Total2 etc which works provided there are 5 items, any less and it will not total. I have tried various other ways to total without success. Any ideas?
Bard, here are a couple of methods I have used to total the control values on a form (works the same for reports)...

* Write a Conditional Loop

* Sum all the controls individually writing IIF statements...
Code:
IIF([control] is null, 0, [control]) + IIF(next control), etc, etc...
I have a sample database up too, for an invoicing setup, if you haven't seen it. It might be able to provide some insight as well (though it doesn't do any totaling)...

http://www.access-programmers.co.uk/forums/showthread.php?t=137158
 
Creating an invoice

The function Nz worked perfectly - many thanks.
 

Users who are viewing this thread

Back
Top Bottom