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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating Totals from 3 Subforms 1

Status
Not open for further replies.

andyblake

Technical User
Apr 10, 2000
2
GB
I have struggled my way in designing a database to calculate and print invoices.<br>I have now almost finished, but stuck at one of the last hurdles.<br>I have an invoice inputting form. Included within the form are three sub-forms. Which you can access through a 'tab control'<br>The three of an invoice that require data inputting and extended prices calculating are 'Parts used''Labour''+'Sub-contract cost'.<br>On the main form I have fields that calculate the totals for the three data input veriables. <br>Also there are grand total fields that calculates the three sub-totals including tax and execluding tax. <br>All works fine if the invoice is made up of costs in 'parts,Labour and Sub-contract'.<br>The PROBLEM is that not all of the invoiced jobs are made up of 'Parts, labour + Sub-contract'. <br>For example a job may consist of only sub-contract costs. This information is inputted into the relevant sub-form the extended price is displayed in the correct field but the grand total fields are not displaying anything.<br>They only seem to display on invoices made up of 'Parts,labour + Sub-contract'.<br>The grand total fields have the following expression in the control source:[Parts]+[Labour]+[SubContract]<br>What do I need to do?<br>Thanks<br>Andy<br><A HREF="mailto:andy.blake@honeywell.com">andy.blake@honeywell.com</A>
 
the reason you are not getting an answer when the job only consists of one or two of the subforms is becasue Access is weird(technical term) sometimes, it doesn't calculate when a &quot;null&quot; field is involved, it needs a zero.<br><br>One thing you may try is giving a default value of &quot;0&quot; to all value fields, this will give Access something to calculate.&nbsp;&nbsp;if this isn't possible, you could always write a new grand total expression that doesn't include all three if they don't all have values such as:<br><b><br>=(IIf([Parts] Is Null,&quot;0&quot;,[Parts]))+(IIf([Labour] Is Null,&quot;0&quot;,[Labour]))+(IIf([SubContract] Is Null,&quot;0&quot;,[SubContract]))<br></b><br><br>this statement should fix your problems <p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Thanks Brian<br>a complete success<br>Setting the default to &quot;0&quot; didn't work in this instance although the statement fixed the problem<br>Regards<br>Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top