View Full Version : urgent - adding a total in a subform?


pankajeshwara
11-17-2001, 04:09 PM
i have a form ..reservation form and in this form i have a subform called products.
a client calling in to reserva a room can request ny number of products therefore the product form is in the reservation form.

what actually the problem is that there are two fields in the products subform and i want to output their total in another field.

vatPortion = (netVipCost - netSupplierCost)* 0.1

i have tried everything ..including vbcode where it says that you cant acces a control unless you have focus on it .... i tried to put the event on the vatPortion's gotfocus event.

and i tried expression builder which says that the form is closed or not loaded.

help please.

Jack Cowley
11-17-2001, 04:52 PM
If, for example, the field 'netVipCost' is filled in and the next field you fill in is 'netSupplierCost' then put your code in the After Update event of that field. When you enter the netSupplierCost and exit the field the vatPortion field will be filled in with your calculation. If you are trying to get this calculation to show on the Main Form then take a look at this article

http://support.microsoft.com/support/kb/articles/Q119/1/34.asp?LN=EN-US&SD=gn&FR=0&qry=q119134&rnk=1&src=DHCS_MSPSS_gn_SRCH&SPR=ACC2000

And look at this one too...

http://support.microsoft.com/support/kb/articles/Q209/0/99.ASP?LN=EN-US&SD=gn&FR=0&qry=subforms&rnk=5&src=DHCS_MSPSS_gn_SRCH&SPR=ACC2000